@tscircuit/runframe 0.0.2074 → 0.0.2076
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/standalone.min.js
CHANGED
|
@@ -5621,7 +5621,7 @@ svg { font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; }
|
|
|
5621
5621
|
`&&(M=`
|
|
5622
5622
|
`);var oe=0,le=!1;this.parse=function(ee,ie,ae){if(typeof ee!="string")throw new Error("Input must be a string");var re=ee.length,ue=B.length,ye=M.length,be=k.length,ve=b(N),he=[],Pe=[],de=[],Te=oe=0;if(!ee)return ze();if(F||F!==!1&&ee.indexOf(j)===-1){for(var Ge=ee.split(M),Ye=0;Ye<Ge.length;Ye++){if(de=Ge[Ye],oe+=de.length,Ye!==Ge.length-1)oe+=M.length;else if(ae)return ze();if(!k||de.substring(0,be)!==k){if(ve){if(he=[],De(de.split(B)),je(),le)return ze()}else De(de.split(B));if(L&&L<=Ye)return he=he.slice(0,L),ze(!0)}}return ze()}for(var fe=ee.indexOf(B,oe),Xe=ee.indexOf(M,oe),Fe=new RegExp(p($)+p(j),"g"),we=ee.indexOf(j,oe);;)if(ee[oe]===j)for(we=oe,oe++;;){if((we=ee.indexOf(j,we+1))===-1)return ae||Pe.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:he.length,index:oe}),Le();if(we===re-1)return Le(ee.substring(oe,we).replace(Fe,j));if(j===$&&ee[we+1]===$)we++;else if(j===$||we===0||ee[we-1]!==$){fe!==-1&&fe<we+1&&(fe=ee.indexOf(B,we+1));var Ue=Ee((Xe=Xe!==-1&&Xe<we+1?ee.indexOf(M,we+1):Xe)===-1?fe:Math.min(fe,Xe));if(ee.substr(we+1+Ue,ue)===B){de.push(ee.substring(oe,we).replace(Fe,j)),ee[oe=we+1+Ue+ue]!==j&&(we=ee.indexOf(j,oe)),fe=ee.indexOf(B,oe),Xe=ee.indexOf(M,oe);break}if(Ue=Ee(Xe),ee.substring(we+1+Ue,we+1+Ue+ye)===M){if(de.push(ee.substring(oe,we).replace(Fe,j)),Me(we+1+Ue+ye),fe=ee.indexOf(B,oe),we=ee.indexOf(j,oe),ve&&(je(),le))return ze();if(L&&he.length>=L)return ze(!0);break}Pe.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:he.length,index:oe}),we++}}else if(k&&de.length===0&&ee.substring(oe,oe+be)===k){if(Xe===-1)return ze();oe=Xe+ye,Xe=ee.indexOf(M,oe),fe=ee.indexOf(B,oe)}else if(fe!==-1&&(fe<Xe||Xe===-1))de.push(ee.substring(oe,fe)),oe=fe+ue,fe=ee.indexOf(B,oe);else{if(Xe===-1)break;if(de.push(ee.substring(oe,Xe)),Me(Xe+ye),ve&&(je(),le))return ze();if(L&&he.length>=L)return ze(!0)}return Le();function De(nt){he.push(nt),Te=oe}function Ee(nt){var at=0;return at=nt!==-1&&(nt=ee.substring(we+1,nt))&&nt.trim()===""?nt.length:at}function Le(nt){return ae||(nt===void 0&&(nt=ee.substring(oe)),de.push(nt),oe=re,De(de),ve&&je()),ze()}function Me(nt){oe=nt,De(de),de=[],Xe=ee.indexOf(M,oe)}function ze(nt){if(P.header&&!ie&&he.length&&!W){var at=he[0],At=Object.create(null),lt=new Set(at);let xt=!1;for(let vt=0;vt<at.length;vt++){let pt=at[vt];if(At[pt=b(P.transformHeader)?P.transformHeader(pt,vt):pt]){let wt,Ht=At[pt];for(;wt=pt+"_"+Ht,Ht++,lt.has(wt););lt.add(wt),at[vt]=wt,At[pt]++,xt=!0,(G=G===null?{}:G)[wt]=pt}else At[pt]=1,at[vt]=pt;lt.add(pt)}xt&&console.warn("Duplicate headers found and renamed."),W=!0}return{data:he,errors:Pe,meta:{delimiter:B,linebreak:M,aborted:le,truncated:!!nt,cursor:Te+(ie||0),renamedHeaders:G}}}function je(){N(ze()),he=[],Pe=[]}},this.abort=function(){le=!0},this.getCharIndex=function(){return oe}}function f(P){var B=P.data,M=a[B.workerId],k=!1;if(B.error)M.userError(B.error,B.file);else if(B.results&&B.results.data){var N={abort:function(){k=!0,y(B.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:C,resume:C};if(b(M.userStep)){for(var L=0;L<B.results.data.length&&(M.userStep({data:B.results.data[L],errors:B.results.errors,meta:B.results.meta},N),!k);L++);delete B.results}else b(M.userChunk)&&(M.userChunk(B.results,N,B.file),delete B.results)}B.finished&&!k&&y(B.workerId,B.results)}function y(P,B){var M=a[P];b(M.userComplete)&&M.userComplete(B),M.terminate(),delete a[P]}function C(){throw new Error("Not implemented.")}function I(P){if(typeof P!="object"||P===null)return P;var B,M=Array.isArray(P)?[]:{};for(B in P)M[B]=I(P[B]);return M}function E(P,B){return function(){P.apply(B,arguments)}}function b(P){return typeof P=="function"}return l.parse=function(P,B){var M=(B=B||{}).dynamicTyping||!1;if(b(M)&&(B.dynamicTypingFunction=M,M={}),B.dynamicTyping=M,B.transform=!!b(B.transform)&&B.transform,!B.worker||!l.WORKERS_SUPPORTED)return M=null,l.NODE_STREAM_INPUT,typeof P=="string"?(P=(k=>k.charCodeAt(0)!==65279?k:k.slice(1))(P),M=new(B.download?u:_)(B)):P.readable===!0&&b(P.read)&&b(P.on)?M=new h(B):(o.File&&P instanceof File||P instanceof Object)&&(M=new d(B)),M.stream(P);(M=(()=>{var k;return!!l.WORKERS_SUPPORTED&&(k=(()=>{var N=o.URL||o.webkitURL||null,L=n.toString();return l.BLOB_URL||(l.BLOB_URL=N.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",L,")();"],{type:"text/javascript"})))})(),(k=new o.Worker(k)).onmessage=f,k.id=c++,a[k.id]=k)})()).userStep=B.step,M.userChunk=B.chunk,M.userComplete=B.complete,M.userError=B.error,B.step=b(B.step),B.chunk=b(B.chunk),B.complete=b(B.complete),B.error=b(B.error),delete B.worker,M.postMessage({input:P,config:B,workerId:M.id})},l.unparse=function(P,B){var M=!1,k=!0,N=",",L=`\r
|
|
5623
5623
|
`,F='"',G=F+F,W=!1,j=null,$=!1,oe=((()=>{if(typeof B=="object"){if(typeof B.delimiter!="string"||l.BAD_DELIMITERS.filter(function(ie){return B.delimiter.indexOf(ie)!==-1}).length||(N=B.delimiter),typeof B.quotes!="boolean"&&typeof B.quotes!="function"&&!Array.isArray(B.quotes)||(M=B.quotes),typeof B.skipEmptyLines!="boolean"&&typeof B.skipEmptyLines!="string"||(W=B.skipEmptyLines),typeof B.newline=="string"&&(L=B.newline),typeof B.quoteChar=="string"&&(F=B.quoteChar),typeof B.header=="boolean"&&(k=B.header),Array.isArray(B.columns)){if(B.columns.length===0)throw new Error("Option columns is empty");j=B.columns}B.escapeChar!==void 0&&(G=B.escapeChar+F),B.escapeFormulae instanceof RegExp?$=B.escapeFormulae:typeof B.escapeFormulae=="boolean"&&B.escapeFormulae&&($=/^[=+\-@\t\r].*$/)}})(),new RegExp(p(F),"g"));if(typeof P=="string"&&(P=JSON.parse(P)),Array.isArray(P)){if(!P.length||Array.isArray(P[0]))return le(null,P,W);if(typeof P[0]=="object")return le(j||Object.keys(P[0]),P,W)}else if(typeof P=="object")return typeof P.data=="string"&&(P.data=JSON.parse(P.data)),Array.isArray(P.data)&&(P.fields||(P.fields=P.meta&&P.meta.fields||j),P.fields||(P.fields=Array.isArray(P.data[0])?P.fields:typeof P.data[0]=="object"?Object.keys(P.data[0]):[]),Array.isArray(P.data[0])||typeof P.data[0]=="object"||(P.data=[P.data])),le(P.fields||[],P.data||[],W);throw new Error("Unable to serialize unrecognized input");function le(ie,ae,re){var ue="",ye=(typeof ie=="string"&&(ie=JSON.parse(ie)),typeof ae=="string"&&(ae=JSON.parse(ae)),Array.isArray(ie)&&0<ie.length),be=!Array.isArray(ae[0]);if(ye&&k){for(var ve=0;ve<ie.length;ve++)0<ve&&(ue+=N),ue+=ee(ie[ve],ve);0<ae.length&&(ue+=L)}for(var he=0;he<ae.length;he++){var Pe=(ye?ie:ae[he]).length,de=!1,Te=ye?Object.keys(ae[he]).length===0:ae[he].length===0;if(re&&!ye&&(de=re==="greedy"?ae[he].join("").trim()==="":ae[he].length===1&&ae[he][0].length===0),re==="greedy"&&ye){for(var Ge=[],Ye=0;Ye<Pe;Ye++){var fe=be?ie[Ye]:Ye;Ge.push(ae[he][fe])}de=Ge.join("").trim()===""}if(!de){for(var Xe=0;Xe<Pe;Xe++){0<Xe&&!Te&&(ue+=N);var Fe=ye&&be?ie[Xe]:Xe;ue+=ee(ae[he][Fe],Xe)}he<ae.length-1&&(!re||0<Pe&&!Te)&&(ue+=L)}}return ue}function ee(ie,ae){var re,ue;return ie==null?"":ie.constructor===Date?JSON.stringify(ie).slice(1,25):(ue=!1,$&&typeof ie=="string"&&$.test(ie)&&(ie="'"+ie,ue=!0),re=ie.toString().replace(oe,G),(ue=ue||M===!0||typeof M=="function"&&M(ie,ae)||Array.isArray(M)&&M[ae]||((ye,be)=>{for(var ve=0;ve<be.length;ve++)if(-1<ye.indexOf(be[ve]))return!0;return!1})(re,l.BAD_DELIMITERS)||-1<re.indexOf(N)||re.charAt(0)===" "||re.charAt(re.length-1)===" ")?F+re+F:re)}},l.RECORD_SEP="",l.UNIT_SEP="",l.BYTE_ORDER_MARK="\uFEFF",l.BAD_DELIMITERS=["\r",`
|
|
5624
|
-
`,'"',l.BYTE_ORDER_MARK],l.WORKERS_SUPPORTED=!r&&!!o.Worker,l.NODE_STREAM_INPUT=1,l.LocalChunkSize=10485760,l.RemoteChunkSize=5242880,l.DefaultDelimiter=",",l.Parser=g,l.ParserHandle=m,l.NetworkStreamer=u,l.FileStreamer=d,l.StringStreamer=_,l.ReadableStreamStreamer=h,o.jQuery&&((i=o.jQuery).fn.parse=function(P){var B=P.config||{},M=[];return this.each(function(L){if(!(i(this).prop("tagName").toUpperCase()==="INPUT"&&i(this).attr("type").toLowerCase()==="file"&&o.FileReader)||!this.files||this.files.length===0)return!0;for(var F=0;F<this.files.length;F++)M.push({file:this.files[F],inputElem:this,instanceConfig:i.extend({},B)})}),k(),this;function k(){if(M.length===0)b(P.complete)&&P.complete();else{var L,F,G,W,j=M[0];if(b(P.before)){var $=P.before(j.file,j.inputElem);if(typeof $=="object"){if($.action==="abort")return L="AbortError",F=j.file,G=j.inputElem,W=$.reason,void(b(P.error)&&P.error({name:L},F,G,W));if($.action==="skip")return void N();typeof $.config=="object"&&(j.instanceConfig=i.extend(j.instanceConfig,$.config))}else if($==="skip")return void N()}var oe=j.instanceConfig.complete;j.instanceConfig.complete=function(le){b(oe)&&oe(le,j.file,j.inputElem),N()},l.parse(j.file,j.instanceConfig)}}function N(){M.splice(0,1),k()}}),s&&(o.onmessage=function(P){P=P.data,l.WORKER_ID===void 0&&P&&(l.WORKER_ID=P.workerId),typeof P.input=="string"?o.postMessage({workerId:l.WORKER_ID,results:l.parse(P.input,P.config),finished:!0}):(o.File&&P.input instanceof File||P.input instanceof Object)&&(P=l.parse(P.input,P.config))&&o.postMessage({workerId:l.WORKER_ID,results:P,finished:!0})}),(u.prototype=Object.create(A.prototype)).constructor=u,(d.prototype=Object.create(A.prototype)).constructor=d,(_.prototype=Object.create(_.prototype)).constructor=_,(h.prototype=Object.create(A.prototype)).constructor=h,l})})(Bee)),Bee.exports}var Q1o=D1o();const ZEt=f2(Q1o);var ebt=async({circuitJson:t,resolvePart:e})=>{const n=[];for(const o of t){if(o.type!=="pcb_component")continue;const i=t.find(c=>c.type==="source_component"&&c.source_component_id===o.source_component_id);if(!i)continue;const r=await e?.({pcb_component:o,source_component:i})??{};let s="";i.ftype==="simple_resistor"&&(s=tbt(i.resistance)),i.ftype==="simple_capacitor"&&(s=tbt(i.capacitance));const a=!!o.do_not_place;n.push({designator:i.name??o.pcb_component_id,comment:a?"DNP":s,value:a?"DNP":s,footprint:r.footprint||"",supplier_part_number_columns:a?void 0:r.supplier_part_number_columns??(i.supplier_part_numbers?T1o(i.supplier_part_numbers):void 0)})}return n};function T1o(t){const e={};return t?.jlcpcb&&(e["JLCPCB Part #"]=t.jlcpcb[0]),t?.lcsc&&(e["JLCPCB Part #"]=t.lcsc[0]),e}function tbt(t){return t==null?"":typeof t=="string"?t:M1o.formatSI(t)}var R1o=t=>{const e=t.map(o=>{const i=o.supplier_part_number_columns;return Object.values(i||{}).join(", "),Object.entries(o.extra_columns||{}).map(([r,s])=>`${r}: ${s}`).join(", "),{Designator:o.designator,Comment:o.comment,Value:o.value,Footprint:o.footprint,...i}}),n=["Designator","Comment","Value","Footprint"];for(const o of e)for(const i in o)n.includes(i)||n.push(i);return ZEt.unparse(e,{columns:n})};const N1o=(t,e)=>K.jsx("a",{className:"rf-underline rf-text-blue-500",target:"_blank",rel:"noreferrer",href:`https://jlcpcb.com/partdetail/${e}`,children:e}),k1o=t=>t?.map(({manufacturer:e,mpn:n})=>`${e}: ${n}`).join(", "),H1o=t=>{const e=new Set;let n=!1,o=!1;for(const i of t){i.supplier_part_number_columns?.["JLCPCB Part #"]!==void 0&&(n=!0);for(const r of Object.keys(i.extra_columns??{}))e.add(r);(i.manufacturer_mpn_pairs?.length??0)>0&&(o=!0)}return{extraColumnNames:[...e],hasSupplierColumn:n,hasManufacturerColumn:o}},L1o=t=>{const e=[{key:"designator",label:"Designator",getCell:n=>n.designator},{key:"comment",label:"Comment",getCell:n=>n.comment},{key:"value",label:"Component Value",getCell:n=>n.value},{key:"footprint",label:"Footprint",getCell:n=>n.footprint}];t.hasSupplierColumn&&e.push({key:"supplier:JLCPCB Part #",label:"JLCPCB Part #",getCell:n=>{const o=n.supplier_part_number_columns?.["JLCPCB Part #"];return o?N1o("jlcpcb",o):""}}),t.hasManufacturerColumn&&e.push({key:"manufacturer_mpn_pairs",label:"Manufacturer / MPN",getCell:n=>k1o(n.manufacturer_mpn_pairs)});for(const n of t.extraColumnNames)e.push({key:`extra:${n}`,label:n,getCell:o=>o.extra_columns?.[n]||""});return e},F1o=({circuitJson:t})=>{const[e,n]=J.useState(null),[o,i]=J.useState(null);if(J.useEffect(()=>{let a=!1;return(async()=>{try{i(null),n(null);const l=await ebt({circuitJson:t});a||n(l)}catch(l){a||i(l instanceof Error?l.message:"Unknown BOM error")}})(),()=>{a=!0}},[t]),o)throw new Error(o);const r=H1o(e??[]),s=L1o(r);return e?K.jsx("div",{className:"rf-overflow-x-auto",children:K.jsxs("table",{className:"rf-w-full rf-text-left rf-text-sm",children:[K.jsx("thead",{children:K.jsx("tr",{className:"rf-border-b",children:s.map(a=>K.jsx("th",{className:"rf-p-2",children:a.label},a.key))})}),K.jsx("tbody",{children:e.map((a,c)=>K.jsx("tr",{className:"rf-border-b",children:s.map(l=>K.jsx("td",{className:"rf-p-2",children:l.getCell(a)},l.key))},a.designator||`${c}`))})]})}):K.jsx("div",{className:"rf-p-4 rf-text-sm rf-text-muted-foreground",children:"Loading BOM..."})},mPe=J.forwardRef(({className:t,type:e,...n},o)=>K.jsx("input",{type:e,className:Li("rf-flex rf-h-9 rf-w-full rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-px-3 rf-py-1 rf-text-sm rf-shadow-sm rf-transition-colors file:rf-border-0 file:rf-bg-transparent file:rf-text-sm file:rf-font-medium placeholder:rf-text-zinc-500 focus-visible:rf-outline-none focus-visible:rf-ring-1 focus-visible:rf-ring-zinc-950 disabled:rf-cursor-not-allowed disabled:rf-opacity-50 dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-placeholder-zinc-400 dark:focus-visible:rf-ring-zinc-300",t),ref:o,...n}));mPe.displayName="Input";const lO=t=>typeof t=="number"&&!isNaN(t),K8=t=>typeof t=="string",wx=t=>typeof t=="function",Mee=t=>K8(t)||wx(t)?t:null,gPe=t=>J.isValidElement(t)||K8(t)||wx(t)||lO(t);function O1o(t,e,n){n===void 0&&(n=300);const{scrollHeight:o,style:i}=t;requestAnimationFrame(()=>{i.minHeight="initial",i.height=o+"px",i.transition=`all ${n}ms`,requestAnimationFrame(()=>{i.height="0",i.padding="0",i.margin="0",setTimeout(e,n)})})}function wee(t){let{enter:e,exit:n,appendPosition:o=!1,collapse:i=!0,collapseDuration:r=300}=t;return function(s){let{children:a,position:c,preventExitTransition:l,done:A,nodeRef:u,isIn:d,playToast:_}=s;const h=o?`${e}--${c}`:e,m=o?`${n}--${c}`:n,p=J.useRef(0);return J.useLayoutEffect(()=>{const g=u.current,f=h.split(" "),y=C=>{C.target===u.current&&(_(),g.removeEventListener("animationend",y),g.removeEventListener("animationcancel",y),p.current===0&&C.type!=="animationcancel"&&g.classList.remove(...f))};g.classList.add(...f),g.addEventListener("animationend",y),g.addEventListener("animationcancel",y)},[]),J.useEffect(()=>{const g=u.current,f=()=>{g.removeEventListener("animationend",f),i?O1o(g,A,r):A()};d||(l?f():(p.current=1,g.className+=` ${m}`,g.addEventListener("animationend",f)))},[d]),lr.createElement(lr.Fragment,null,a)}}function nbt(t,e){return t!=null?{content:t.content,containerId:t.props.containerId,id:t.props.toastId,theme:t.props.theme,type:t.props.type,data:t.props.data||{},isLoading:t.props.isLoading,icon:t.props.icon,status:e}:{}}const F1=new Map;let AO=[];const pPe=new Set,G1o=t=>pPe.forEach(e=>e(t)),obt=()=>F1.size>0;function ibt(t,e){var n;if(e)return!((n=F1.get(e))==null||!n.isToastActive(t));let o=!1;return F1.forEach(i=>{i.isToastActive(t)&&(o=!0)}),o}function rbt(t,e){gPe(t)&&(obt()||AO.push({content:t,options:e}),F1.forEach(n=>{n.buildToast(t,e)}))}function sbt(t,e){F1.forEach(n=>{e!=null&&e!=null&&e.containerId?e?.containerId===n.id&&n.toggle(t,e?.id):n.toggle(t,e?.id)})}function U1o(t){const{subscribe:e,getSnapshot:n,setProps:o}=J.useRef((function(r){const s=r.containerId||1;return{subscribe(a){const c=(function(A,u,d){let _=1,h=0,m=[],p=[],g=[],f=u;const y=new Map,C=new Set,I=()=>{g=Array.from(y.values()),C.forEach(P=>P())},E=P=>{p=P==null?[]:p.filter(B=>B!==P),I()},b=P=>{const{toastId:B,onOpen:M,updateId:k,children:N}=P.props,L=k==null;P.staleId&&y.delete(P.staleId),y.set(B,P),p=[...p,P.props.toastId].filter(F=>F!==P.staleId),I(),d(nbt(P,L?"added":"updated")),L&&wx(M)&&M(J.isValidElement(N)&&N.props)};return{id:A,props:f,observe:P=>(C.add(P),()=>C.delete(P)),toggle:(P,B)=>{y.forEach(M=>{B!=null&&B!==M.props.toastId||wx(M.toggle)&&M.toggle(P)})},removeToast:E,toasts:y,clearQueue:()=>{h-=m.length,m=[]},buildToast:(P,B)=>{if((ie=>{let{containerId:ae,toastId:re,updateId:ue}=ie;const ye=ae?ae!==A:A!==1,be=y.has(re)&&ue==null;return ye||be})(B))return;const{toastId:M,updateId:k,data:N,staleId:L,delay:F}=B,G=()=>{E(M)},W=k==null;W&&h++;const j={...f,style:f.toastStyle,key:_++,...Object.fromEntries(Object.entries(B).filter(ie=>{let[ae,re]=ie;return re!=null})),toastId:M,updateId:k,data:N,closeToast:G,isIn:!1,className:Mee(B.className||f.toastClassName),bodyClassName:Mee(B.bodyClassName||f.bodyClassName),progressClassName:Mee(B.progressClassName||f.progressClassName),autoClose:!B.isLoading&&($=B.autoClose,oe=f.autoClose,$===!1||lO($)&&$>0?$:oe),deleteToast(){const ie=y.get(M),{onClose:ae,children:re}=ie.props;wx(ae)&&ae(J.isValidElement(re)&&re.props),d(nbt(ie,"removed")),y.delete(M),h--,h<0&&(h=0),m.length>0?b(m.shift()):I()}};var $,oe;j.closeButton=f.closeButton,B.closeButton===!1||gPe(B.closeButton)?j.closeButton=B.closeButton:B.closeButton===!0&&(j.closeButton=!gPe(f.closeButton)||f.closeButton);let le=P;J.isValidElement(P)&&!K8(P.type)?le=J.cloneElement(P,{closeToast:G,toastProps:j,data:N}):wx(P)&&(le=P({closeToast:G,toastProps:j,data:N}));const ee={content:le,props:j,staleId:L};f.limit&&f.limit>0&&h>f.limit&&W?m.push(ee):lO(F)?setTimeout(()=>{b(ee)},F):b(ee)},setProps(P){f=P},setToggle:(P,B)=>{y.get(P).toggle=B},isToastActive:P=>p.some(B=>B===P),getSnapshot:()=>g}})(s,r,G1o);F1.set(s,c);const l=c.observe(a);return AO.forEach(A=>rbt(A.content,A.options)),AO=[],()=>{l(),F1.delete(s)}},setProps(a){var c;(c=F1.get(s))==null||c.setProps(a)},getSnapshot(){var a;return(a=F1.get(s))==null?void 0:a.getSnapshot()}}})(t)).current;o(t);const i=J.useSyncExternalStore(e,n,n);return{getToastToRender:function(r){if(!i)return[];const s=new Map;return t.newestOnTop&&i.reverse(),i.forEach(a=>{const{position:c}=a.props;s.has(c)||s.set(c,[]),s.get(c).push(a)}),Array.from(s,a=>r(a[0],a[1]))},isToastActive:ibt,count:i?.length}}function z1o(t){const[e,n]=J.useState(!1),[o,i]=J.useState(!1),r=J.useRef(null),s=J.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:a,pauseOnHover:c,closeToast:l,onClick:A,closeOnClick:u}=t;var d,_;function h(){n(!0)}function m(){n(!1)}function p(y){const C=r.current;s.canDrag&&C&&(s.didMove=!0,e&&m(),s.delta=t.draggableDirection==="x"?y.clientX-s.start:y.clientY-s.start,s.start!==y.clientX&&(s.canCloseOnClick=!1),C.style.transform=`translate3d(${t.draggableDirection==="x"?`${s.delta}px, var(--y)`:`0, calc(${s.delta}px + var(--y))`},0)`,C.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function g(){document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",g);const y=r.current;if(s.canDrag&&s.didMove&&y){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance)return i(!0),t.closeToast(),void t.collapseAll();y.style.transition="transform 0.2s, opacity 0.2s",y.style.removeProperty("transform"),y.style.removeProperty("opacity")}}(_=F1.get((d={id:t.toastId,containerId:t.containerId,fn:n}).containerId||1))==null||_.setToggle(d.id,d.fn),J.useEffect(()=>{if(t.pauseOnFocusLoss)return document.hasFocus()||m(),window.addEventListener("focus",h),window.addEventListener("blur",m),()=>{window.removeEventListener("focus",h),window.removeEventListener("blur",m)}},[t.pauseOnFocusLoss]);const f={onPointerDown:function(y){if(t.draggable===!0||t.draggable===y.pointerType){s.didMove=!1,document.addEventListener("pointermove",p),document.addEventListener("pointerup",g);const C=r.current;s.canCloseOnClick=!0,s.canDrag=!0,C.style.transition="none",t.draggableDirection==="x"?(s.start=y.clientX,s.removalDistance=C.offsetWidth*(t.draggablePercent/100)):(s.start=y.clientY,s.removalDistance=C.offsetHeight*(t.draggablePercent===80?1.5*t.draggablePercent:t.draggablePercent)/100)}},onPointerUp:function(y){const{top:C,bottom:I,left:E,right:b}=r.current.getBoundingClientRect();y.nativeEvent.type!=="touchend"&&t.pauseOnHover&&y.clientX>=E&&y.clientX<=b&&y.clientY>=C&&y.clientY<=I?m():h()}};return a&&c&&(f.onMouseEnter=m,t.stacked||(f.onMouseLeave=h)),u&&(f.onClick=y=>{A&&A(y),s.canCloseOnClick&&l()}),{playToast:h,pauseToast:m,isRunning:e,preventExitTransition:o,toastRef:r,eventHandlers:f}}function V1o(t){let{delay:e,isRunning:n,closeToast:o,type:i="default",hide:r,className:s,style:a,controlledProgress:c,progress:l,rtl:A,isIn:u,theme:d}=t;const _=r||c&&l===0,h={...a,animationDuration:`${e}ms`,animationPlayState:n?"running":"paused"};c&&(h.transform=`scaleX(${l})`);const m=VI("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${d}`,`Toastify__progress-bar--${i}`,{"Toastify__progress-bar--rtl":A}),p=wx(s)?s({rtl:A,type:i,defaultClassName:m}):VI(m,s),g={[c&&l>=1?"onTransitionEnd":"onAnimationEnd"]:c&&l<1?null:()=>{u&&o()}};return lr.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":_},lr.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${d} Toastify__progress-bar--${i}`}),lr.createElement("div",{role:"progressbar","aria-hidden":_?"true":"false","aria-label":"notification timer",className:p,style:h,...g}))}let Y1o=1;const abt=()=>""+Y1o++;function K1o(t){return t&&(K8(t.toastId)||lO(t.toastId))?t.toastId:abt()}function uO(t,e){return rbt(t,e),e.toastId}function Dee(t,e){return{...e,type:e&&e.type||t,toastId:K1o(e)}}function Qee(t){return(e,n)=>uO(e,Dee(t,n))}function KA(t,e){return uO(t,Dee("default",e))}KA.loading=(t,e)=>uO(t,Dee("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...e})),KA.promise=function(t,e,n){let o,{pending:i,error:r,success:s}=e;i&&(o=K8(i)?KA.loading(i,n):KA.loading(i.render,{...n,...i}));const a={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},c=(A,u,d)=>{if(u==null)return void KA.dismiss(o);const _={type:A,...a,...n,data:d},h=K8(u)?{render:u}:u;return o?KA.update(o,{..._,...h}):KA(h.render,{..._,...h}),d},l=wx(t)?t():t;return l.then(A=>c("success",s,A)).catch(A=>c("error",r,A)),l},KA.success=Qee("success"),KA.info=Qee("info"),KA.error=Qee("error"),KA.warning=Qee("warning"),KA.warn=KA.warning,KA.dark=(t,e)=>uO(t,Dee("default",{theme:"dark",...e})),KA.dismiss=function(t){(function(e){var n;if(obt()){if(e==null||K8(n=e)||lO(n))F1.forEach(o=>{o.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){const o=F1.get(e.containerId);o?o.removeToast(e.id):F1.forEach(i=>{i.removeToast(e.id)})}}else AO=AO.filter(o=>e!=null&&o.options.toastId!==e)})(t)},KA.clearWaitingQueue=function(t){t===void 0&&(t={}),F1.forEach(e=>{!e.props.limit||t.containerId&&e.id!==t.containerId||e.clearQueue()})},KA.isActive=ibt,KA.update=function(t,e){e===void 0&&(e={});const n=((o,i)=>{var r;let{containerId:s}=i;return(r=F1.get(s||1))==null?void 0:r.toasts.get(o)})(t,e);if(n){const{props:o,content:i}=n,r={delay:100,...o,...e,toastId:e.toastId||t,updateId:abt()};r.toastId!==t&&(r.staleId=t);const s=r.render||i;delete r.render,uO(s,r)}},KA.done=t=>{KA.update(t,{progress:1})},KA.onChange=function(t){return pPe.add(t),()=>{pPe.delete(t)}},KA.play=t=>sbt(!0,t),KA.pause=t=>sbt(!1,t);const W1o=typeof window<"u"?J.useLayoutEffect:J.useEffect,Tee=t=>{let{theme:e,type:n,isLoading:o,...i}=t;return lr.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${n})`,...i})},fPe={info:function(t){return lr.createElement(Tee,{...t},lr.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(t){return lr.createElement(Tee,{...t},lr.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(t){return lr.createElement(Tee,{...t},lr.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(t){return lr.createElement(Tee,{...t},lr.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return lr.createElement("div",{className:"Toastify__spinner"})}},j1o=t=>{const{isRunning:e,preventExitTransition:n,toastRef:o,eventHandlers:i,playToast:r}=z1o(t),{closeButton:s,children:a,autoClose:c,onClick:l,type:A,hideProgressBar:u,closeToast:d,transition:_,position:h,className:m,style:p,bodyClassName:g,bodyStyle:f,progressClassName:y,progressStyle:C,updateId:I,role:E,progress:b,rtl:P,toastId:B,deleteToast:M,isIn:k,isLoading:N,closeOnClick:L,theme:F}=t,G=VI("Toastify__toast",`Toastify__toast-theme--${F}`,`Toastify__toast--${A}`,{"Toastify__toast--rtl":P},{"Toastify__toast--close-on-click":L}),W=wx(m)?m({rtl:P,position:h,type:A,defaultClassName:G}):VI(G,m),j=(function(ee){let{theme:ie,type:ae,isLoading:re,icon:ue}=ee,ye=null;const be={theme:ie,type:ae};return ue===!1||(wx(ue)?ye=ue({...be,isLoading:re}):J.isValidElement(ue)?ye=J.cloneElement(ue,be):re?ye=fPe.spinner():(ve=>ve in fPe)(ae)&&(ye=fPe[ae](be))),ye})(t),$=!!b||!c,oe={closeToast:d,type:A,theme:F};let le=null;return s===!1||(le=wx(s)?s(oe):J.isValidElement(s)?J.cloneElement(s,oe):(function(ee){let{closeToast:ie,theme:ae,ariaLabel:re="close"}=ee;return lr.createElement("button",{className:`Toastify__close-button Toastify__close-button--${ae}`,type:"button",onClick:ue=>{ue.stopPropagation(),ie(ue)},"aria-label":re},lr.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},lr.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))})(oe)),lr.createElement(_,{isIn:k,done:M,position:h,preventExitTransition:n,nodeRef:o,playToast:r},lr.createElement("div",{id:B,onClick:l,"data-in":k,className:W,...i,style:p,ref:o},lr.createElement("div",{...k&&{role:E},className:wx(g)?g({type:A}):VI("Toastify__toast-body",g),style:f},j!=null&&lr.createElement("div",{className:VI("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!N})},j),lr.createElement("div",null,a)),le,lr.createElement(V1o,{...I&&!$?{key:`pb-${I}`}:{},rtl:P,theme:F,delay:c,isRunning:e,isIn:k,closeToast:d,hide:u,type:A,style:C,className:y,controlledProgress:$,progress:b||0})))},Ree=function(t,e){return e===void 0&&(e=!1),{enter:`Toastify--animate Toastify__${t}-enter`,exit:`Toastify--animate Toastify__${t}-exit`,appendPosition:e}},X1o=wee(Ree("bounce",!0));wee(Ree("slide",!0)),wee(Ree("zoom")),wee(Ree("flip"));const J1o={position:"top-right",transition:X1o,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function q1o(t){let e={...J1o,...t};const n=t.stacked,[o,i]=J.useState(!0),r=J.useRef(null),{getToastToRender:s,isToastActive:a,count:c}=U1o(e),{className:l,style:A,rtl:u,containerId:d}=e;function _(m){const p=VI("Toastify__toast-container",`Toastify__toast-container--${m}`,{"Toastify__toast-container--rtl":u});return wx(l)?l({position:m,rtl:u,defaultClassName:p}):VI(p,Mee(l))}function h(){n&&(i(!0),KA.play())}return W1o(()=>{if(n){var m;const p=r.current.querySelectorAll('[data-in="true"]'),g=12,f=(m=e.position)==null?void 0:m.includes("top");let y=0,C=0;Array.from(p).reverse().forEach((I,E)=>{const b=I;b.classList.add("Toastify__toast--stacked"),E>0&&(b.dataset.collapsed=`${o}`),b.dataset.pos||(b.dataset.pos=f?"top":"bot");const P=y*(o?.2:1)+(o?0:g*E);b.style.setProperty("--y",`${f?P:-1*P}px`),b.style.setProperty("--g",`${g}`),b.style.setProperty("--s",""+(1-(o?C:0))),y+=b.offsetHeight,C+=.025})}},[o,c,n]),lr.createElement("div",{ref:r,className:"Toastify",id:d,onMouseEnter:()=>{n&&(i(!1),KA.pause())},onMouseLeave:h},s((m,p)=>{const g=p.length?{...A}:{...A,pointerEvents:"none"};return lr.createElement("div",{className:_(m),style:g,key:`container-${m}`},p.map(f=>{let{content:y,props:C}=f;return lr.createElement(j1o,{...C,stacked:n,collapseAll:h,isIn:a(C.toastId,C.containerId),style:C.style,key:`toast-${C.key}`},y)}))}))}function $1o(){var t=':root{--toastify-color-light:#fff;--toastify-color-dark:#121212;--toastify-color-info:#3498db;--toastify-color-success:#07bc0c;--toastify-color-warning:#f1c40f;--toastify-color-error:#e74c3c;--toastify-color-transparent:hsla(0,0%,100%,.7);--toastify-icon-color-info:var(--toastify-color-info);--toastify-icon-color-success:var(--toastify-color-success);--toastify-icon-color-warning:var(--toastify-color-warning);--toastify-icon-color-error:var(--toastify-color-error);--toastify-toast-width:320px;--toastify-toast-offset:16px;--toastify-toast-top:max(var(--toastify-toast-offset),env(safe-area-inset-top));--toastify-toast-right:max(var(--toastify-toast-offset),env(safe-area-inset-right));--toastify-toast-left:max(var(--toastify-toast-offset),env(safe-area-inset-left));--toastify-toast-bottom:max(var(--toastify-toast-offset),env(safe-area-inset-bottom));--toastify-toast-background:#fff;--toastify-toast-min-height:64px;--toastify-toast-max-height:800px;--toastify-toast-bd-radius:6px;--toastify-font-family:sans-serif;--toastify-z-index:9999;--toastify-text-color-light:#757575;--toastify-text-color-dark:#fff;--toastify-text-color-info:#fff;--toastify-text-color-success:#fff;--toastify-text-color-warning:#fff;--toastify-text-color-error:#fff;--toastify-spinner-color:#616161;--toastify-spinner-color-empty-area:#e0e0e0;--toastify-color-progress-light:linear-gradient(90deg,#4cd964,#5ac8fa,#007aff,#34aadc,#5856d6,#ff2d55);--toastify-color-progress-dark:#bb86fc;--toastify-color-progress-info:var(--toastify-color-info);--toastify-color-progress-success:var(--toastify-color-success);--toastify-color-progress-warning:var(--toastify-color-warning);--toastify-color-progress-error:var(--toastify-color-error);--toastify-color-progress-bgo:0.2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translateZ(var(--toastify-z-index));position:fixed;padding:4px;width:var(--toastify-toast-width);box-sizing:border-box;color:#fff}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translateX(-50%)}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right)}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translateX(-50%)}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right)}@media only screen and (max-width:480px){.Toastify__toast-container{width:100vw;padding:0;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-center,.Toastify__toast-container--top-left,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translateX(0)}.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translateX(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:auto}}.Toastify__toast{--y:0;position:relative;-ms-touch-action:none;touch-action:none;min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:8px;border-radius:var(--toastify-toast-bd-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);cursor:default;direction:ltr;z-index:0;overflow:hidden}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__close-button,.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-body{margin:auto 0;-ms-flex:1 1 auto;flex:1 1 auto;padding:6px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.Toastify__toast-body>div:last-child{word-break:break-word;-ms-flex:1;flex:1}.Toastify__toast-icon{-webkit-margin-end:10px;margin-inline-end:10px;width:20px;-ms-flex-negative:0;flex-shrink:0;display:-ms-flexbox;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}@media only screen and (max-width:480px){.Toastify__toast{margin-bottom:0;border-radius:0}}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--colored.Toastify__toast--default,.Toastify__toast-theme--light{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;-ms-flex-item-align:start;align-self:flex-start;z-index:1}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:focus,.Toastify__close-button:hover{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:var(--toastify-z-index);opacity:.7;transform-origin:left;border-bottom-left-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:auto;transform-origin:right;border-bottom-left-radius:0;border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp{position:absolute;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--bottom-left,.Toastify__bounce-enter--top-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--bottom-right,.Toastify__bounce-enter--top-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--bottom-left,.Toastify__bounce-exit--top-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--bottom-right,.Toastify__bounce-exit--top-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--bottom-left,.Toastify__slide-enter--top-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--bottom-right,.Toastify__slide-enter--top-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--bottom-left,.Toastify__slide-exit--top-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-right,.Toastify__slide-exit--top-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}',e=document.createElement("style");e.innerText=t,document.head.appendChild(e)}var yPe={exports:{}},CPe,cbt;function lbt(){return cbt||(cbt=1,CPe={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),CPe}var xPe={exports:{}},IPe,Abt;function Z1o(){return Abt||(Abt=1,IPe=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")}),IPe}var ubt;function eyo(){if(ubt)return xPe.exports;ubt=1;var t=Z1o(),e=Array.prototype.concat,n=Array.prototype.slice,o=xPe.exports=function(r){for(var s=[],a=0,c=r.length;a<c;a++){var l=r[a];t(l)?s=e.call(s,n.call(l)):s.push(l)}return s};return o.wrap=function(i){return function(){return i(o(arguments))}},xPe.exports}var dbt;function tyo(){if(dbt)return yPe.exports;dbt=1;var t=lbt(),e=eyo(),n=Object.hasOwnProperty,o=Object.create(null);for(var i in t)n.call(t,i)&&(o[t[i]]=i);var r=yPe.exports={to:{},get:{}};r.get=function(c){var l=c.substring(0,3).toLowerCase(),A,u;switch(l){case"hsl":A=r.get.hsl(c),u="hsl";break;case"hwb":A=r.get.hwb(c),u="hwb";break;default:A=r.get.rgb(c),u="rgb";break}return A?{model:u,value:A}:null},r.get.rgb=function(c){if(!c)return null;var l=/^#([a-f0-9]{3,4})$/i,A=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,u=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,d=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,_=/^(\w+)$/,h=[0,0,0,1],m,p,g;if(m=c.match(A)){for(g=m[2],m=m[1],p=0;p<3;p++){var f=p*2;h[p]=parseInt(m.slice(f,f+2),16)}g&&(h[3]=parseInt(g,16)/255)}else if(m=c.match(l)){for(m=m[1],g=m[3],p=0;p<3;p++)h[p]=parseInt(m[p]+m[p],16);g&&(h[3]=parseInt(g+g,16)/255)}else if(m=c.match(u)){for(p=0;p<3;p++)h[p]=parseInt(m[p+1],0);m[4]&&(m[5]?h[3]=parseFloat(m[4])*.01:h[3]=parseFloat(m[4]))}else if(m=c.match(d)){for(p=0;p<3;p++)h[p]=Math.round(parseFloat(m[p+1])*2.55);m[4]&&(m[5]?h[3]=parseFloat(m[4])*.01:h[3]=parseFloat(m[4]))}else return(m=c.match(_))?m[1]==="transparent"?[0,0,0,0]:n.call(t,m[1])?(h=t[m[1]],h[3]=1,h):null:null;for(p=0;p<3;p++)h[p]=s(h[p],0,255);return h[3]=s(h[3],0,1),h},r.get.hsl=function(c){if(!c)return null;var l=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,A=c.match(l);if(A){var u=parseFloat(A[4]),d=(parseFloat(A[1])%360+360)%360,_=s(parseFloat(A[2]),0,100),h=s(parseFloat(A[3]),0,100),m=s(isNaN(u)?1:u,0,1);return[d,_,h,m]}return null},r.get.hwb=function(c){if(!c)return null;var l=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,A=c.match(l);if(A){var u=parseFloat(A[4]),d=(parseFloat(A[1])%360+360)%360,_=s(parseFloat(A[2]),0,100),h=s(parseFloat(A[3]),0,100),m=s(isNaN(u)?1:u,0,1);return[d,_,h,m]}return null},r.to.hex=function(){var c=e(arguments);return"#"+a(c[0])+a(c[1])+a(c[2])+(c[3]<1?a(Math.round(c[3]*255)):"")},r.to.rgb=function(){var c=e(arguments);return c.length<4||c[3]===1?"rgb("+Math.round(c[0])+", "+Math.round(c[1])+", "+Math.round(c[2])+")":"rgba("+Math.round(c[0])+", "+Math.round(c[1])+", "+Math.round(c[2])+", "+c[3]+")"},r.to.rgb.percent=function(){var c=e(arguments),l=Math.round(c[0]/255*100),A=Math.round(c[1]/255*100),u=Math.round(c[2]/255*100);return c.length<4||c[3]===1?"rgb("+l+"%, "+A+"%, "+u+"%)":"rgba("+l+"%, "+A+"%, "+u+"%, "+c[3]+")"},r.to.hsl=function(){var c=e(arguments);return c.length<4||c[3]===1?"hsl("+c[0]+", "+c[1]+"%, "+c[2]+"%)":"hsla("+c[0]+", "+c[1]+"%, "+c[2]+"%, "+c[3]+")"},r.to.hwb=function(){var c=e(arguments),l="";return c.length>=4&&c[3]!==1&&(l=", "+c[3]),"hwb("+c[0]+", "+c[1]+"%, "+c[2]+"%"+l+")"},r.to.keyword=function(c){return o[c.slice(0,3)]};function s(c,l,A){return Math.min(Math.max(l,c),A)}function a(c){var l=Math.round(c).toString(16).toUpperCase();return l.length<2?"0"+l:l}return yPe.exports}var EPe,hbt;function _bt(){if(hbt)return EPe;hbt=1;const t=lbt(),e={};for(const i of Object.keys(t))e[t[i]]=i;const n={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};EPe=n;for(const i of Object.keys(n)){if(!("channels"in n[i]))throw new Error("missing channels property: "+i);if(!("labels"in n[i]))throw new Error("missing channel labels property: "+i);if(n[i].labels.length!==n[i].channels)throw new Error("channel and label counts mismatch: "+i);const{channels:r,labels:s}=n[i];delete n[i].channels,delete n[i].labels,Object.defineProperty(n[i],"channels",{value:r}),Object.defineProperty(n[i],"labels",{value:s})}n.rgb.hsl=function(i){const r=i[0]/255,s=i[1]/255,a=i[2]/255,c=Math.min(r,s,a),l=Math.max(r,s,a),A=l-c;let u,d;l===c?u=0:r===l?u=(s-a)/A:s===l?u=2+(a-r)/A:a===l&&(u=4+(r-s)/A),u=Math.min(u*60,360),u<0&&(u+=360);const _=(c+l)/2;return l===c?d=0:_<=.5?d=A/(l+c):d=A/(2-l-c),[u,d*100,_*100]},n.rgb.hsv=function(i){let r,s,a,c,l;const A=i[0]/255,u=i[1]/255,d=i[2]/255,_=Math.max(A,u,d),h=_-Math.min(A,u,d),m=function(p){return(_-p)/6/h+1/2};return h===0?(c=0,l=0):(l=h/_,r=m(A),s=m(u),a=m(d),A===_?c=a-s:u===_?c=1/3+r-a:d===_&&(c=2/3+s-r),c<0?c+=1:c>1&&(c-=1)),[c*360,l*100,_*100]},n.rgb.hwb=function(i){const r=i[0],s=i[1];let a=i[2];const c=n.rgb.hsl(i)[0],l=1/255*Math.min(r,Math.min(s,a));return a=1-1/255*Math.max(r,Math.max(s,a)),[c,l*100,a*100]},n.rgb.cmyk=function(i){const r=i[0]/255,s=i[1]/255,a=i[2]/255,c=Math.min(1-r,1-s,1-a),l=(1-r-c)/(1-c)||0,A=(1-s-c)/(1-c)||0,u=(1-a-c)/(1-c)||0;return[l*100,A*100,u*100,c*100]};function o(i,r){return(i[0]-r[0])**2+(i[1]-r[1])**2+(i[2]-r[2])**2}return n.rgb.keyword=function(i){const r=e[i];if(r)return r;let s=1/0,a;for(const c of Object.keys(t)){const l=t[c],A=o(i,l);A<s&&(s=A,a=c)}return a},n.keyword.rgb=function(i){return t[i]},n.rgb.xyz=function(i){let r=i[0]/255,s=i[1]/255,a=i[2]/255;r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92,a=a>.04045?((a+.055)/1.055)**2.4:a/12.92;const c=r*.4124+s*.3576+a*.1805,l=r*.2126+s*.7152+a*.0722,A=r*.0193+s*.1192+a*.9505;return[c*100,l*100,A*100]},n.rgb.lab=function(i){const r=n.rgb.xyz(i);let s=r[0],a=r[1],c=r[2];s/=95.047,a/=100,c/=108.883,s=s>.008856?s**(1/3):7.787*s+16/116,a=a>.008856?a**(1/3):7.787*a+16/116,c=c>.008856?c**(1/3):7.787*c+16/116;const l=116*a-16,A=500*(s-a),u=200*(a-c);return[l,A,u]},n.hsl.rgb=function(i){const r=i[0]/360,s=i[1]/100,a=i[2]/100;let c,l,A;if(s===0)return A=a*255,[A,A,A];a<.5?c=a*(1+s):c=a+s-a*s;const u=2*a-c,d=[0,0,0];for(let _=0;_<3;_++)l=r+1/3*-(_-1),l<0&&l++,l>1&&l--,6*l<1?A=u+(c-u)*6*l:2*l<1?A=c:3*l<2?A=u+(c-u)*(2/3-l)*6:A=u,d[_]=A*255;return d},n.hsl.hsv=function(i){const r=i[0];let s=i[1]/100,a=i[2]/100,c=s;const l=Math.max(a,.01);a*=2,s*=a<=1?a:2-a,c*=l<=1?l:2-l;const A=(a+s)/2,u=a===0?2*c/(l+c):2*s/(a+s);return[r,u*100,A*100]},n.hsv.rgb=function(i){const r=i[0]/60,s=i[1]/100;let a=i[2]/100;const c=Math.floor(r)%6,l=r-Math.floor(r),A=255*a*(1-s),u=255*a*(1-s*l),d=255*a*(1-s*(1-l));switch(a*=255,c){case 0:return[a,d,A];case 1:return[u,a,A];case 2:return[A,a,d];case 3:return[A,u,a];case 4:return[d,A,a];case 5:return[a,A,u]}},n.hsv.hsl=function(i){const r=i[0],s=i[1]/100,a=i[2]/100,c=Math.max(a,.01);let l,A;A=(2-s)*a;const u=(2-s)*c;return l=s*c,l/=u<=1?u:2-u,l=l||0,A/=2,[r,l*100,A*100]},n.hwb.rgb=function(i){const r=i[0]/360;let s=i[1]/100,a=i[2]/100;const c=s+a;let l;c>1&&(s/=c,a/=c);const A=Math.floor(6*r),u=1-a;l=6*r-A,(A&1)!==0&&(l=1-l);const d=s+l*(u-s);let _,h,m;switch(A){default:case 6:case 0:_=u,h=d,m=s;break;case 1:_=d,h=u,m=s;break;case 2:_=s,h=u,m=d;break;case 3:_=s,h=d,m=u;break;case 4:_=d,h=s,m=u;break;case 5:_=u,h=s,m=d;break}return[_*255,h*255,m*255]},n.cmyk.rgb=function(i){const r=i[0]/100,s=i[1]/100,a=i[2]/100,c=i[3]/100,l=1-Math.min(1,r*(1-c)+c),A=1-Math.min(1,s*(1-c)+c),u=1-Math.min(1,a*(1-c)+c);return[l*255,A*255,u*255]},n.xyz.rgb=function(i){const r=i[0]/100,s=i[1]/100,a=i[2]/100;let c,l,A;return c=r*3.2406+s*-1.5372+a*-.4986,l=r*-.9689+s*1.8758+a*.0415,A=r*.0557+s*-.204+a*1.057,c=c>.0031308?1.055*c**(1/2.4)-.055:c*12.92,l=l>.0031308?1.055*l**(1/2.4)-.055:l*12.92,A=A>.0031308?1.055*A**(1/2.4)-.055:A*12.92,c=Math.min(Math.max(0,c),1),l=Math.min(Math.max(0,l),1),A=Math.min(Math.max(0,A),1),[c*255,l*255,A*255]},n.xyz.lab=function(i){let r=i[0],s=i[1],a=i[2];r/=95.047,s/=100,a/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,a=a>.008856?a**(1/3):7.787*a+16/116;const c=116*s-16,l=500*(r-s),A=200*(s-a);return[c,l,A]},n.lab.xyz=function(i){const r=i[0],s=i[1],a=i[2];let c,l,A;l=(r+16)/116,c=s/500+l,A=l-a/200;const u=l**3,d=c**3,_=A**3;return l=u>.008856?u:(l-16/116)/7.787,c=d>.008856?d:(c-16/116)/7.787,A=_>.008856?_:(A-16/116)/7.787,c*=95.047,l*=100,A*=108.883,[c,l,A]},n.lab.lch=function(i){const r=i[0],s=i[1],a=i[2];let c;c=Math.atan2(a,s)*360/2/Math.PI,c<0&&(c+=360);const A=Math.sqrt(s*s+a*a);return[r,A,c]},n.lch.lab=function(i){const r=i[0],s=i[1],c=i[2]/360*2*Math.PI,l=s*Math.cos(c),A=s*Math.sin(c);return[r,l,A]},n.rgb.ansi16=function(i,r=null){const[s,a,c]=i;let l=r===null?n.rgb.hsv(i)[2]:r;if(l=Math.round(l/50),l===0)return 30;let A=30+(Math.round(c/255)<<2|Math.round(a/255)<<1|Math.round(s/255));return l===2&&(A+=60),A},n.hsv.ansi16=function(i){return n.rgb.ansi16(n.hsv.rgb(i),i[2])},n.rgb.ansi256=function(i){const r=i[0],s=i[1],a=i[2];return r===s&&s===a?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(s/255*5)+Math.round(a/255*5)},n.ansi16.rgb=function(i){let r=i%10;if(r===0||r===7)return i>50&&(r+=3.5),r=r/10.5*255,[r,r,r];const s=(~~(i>50)+1)*.5,a=(r&1)*s*255,c=(r>>1&1)*s*255,l=(r>>2&1)*s*255;return[a,c,l]},n.ansi256.rgb=function(i){if(i>=232){const l=(i-232)*10+8;return[l,l,l]}i-=16;let r;const s=Math.floor(i/36)/5*255,a=Math.floor((r=i%36)/6)/5*255,c=r%6/5*255;return[s,a,c]},n.rgb.hex=function(i){const s=(((Math.round(i[0])&255)<<16)+((Math.round(i[1])&255)<<8)+(Math.round(i[2])&255)).toString(16).toUpperCase();return"000000".substring(s.length)+s},n.hex.rgb=function(i){const r=i.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!r)return[0,0,0];let s=r[0];r[0].length===3&&(s=s.split("").map(u=>u+u).join(""));const a=parseInt(s,16),c=a>>16&255,l=a>>8&255,A=a&255;return[c,l,A]},n.rgb.hcg=function(i){const r=i[0]/255,s=i[1]/255,a=i[2]/255,c=Math.max(Math.max(r,s),a),l=Math.min(Math.min(r,s),a),A=c-l;let u,d;return A<1?u=l/(1-A):u=0,A<=0?d=0:c===r?d=(s-a)/A%6:c===s?d=2+(a-r)/A:d=4+(r-s)/A,d/=6,d%=1,[d*360,A*100,u*100]},n.hsl.hcg=function(i){const r=i[1]/100,s=i[2]/100,a=s<.5?2*r*s:2*r*(1-s);let c=0;return a<1&&(c=(s-.5*a)/(1-a)),[i[0],a*100,c*100]},n.hsv.hcg=function(i){const r=i[1]/100,s=i[2]/100,a=r*s;let c=0;return a<1&&(c=(s-a)/(1-a)),[i[0],a*100,c*100]},n.hcg.rgb=function(i){const r=i[0]/360,s=i[1]/100,a=i[2]/100;if(s===0)return[a*255,a*255,a*255];const c=[0,0,0],l=r%1*6,A=l%1,u=1-A;let d=0;switch(Math.floor(l)){case 0:c[0]=1,c[1]=A,c[2]=0;break;case 1:c[0]=u,c[1]=1,c[2]=0;break;case 2:c[0]=0,c[1]=1,c[2]=A;break;case 3:c[0]=0,c[1]=u,c[2]=1;break;case 4:c[0]=A,c[1]=0,c[2]=1;break;default:c[0]=1,c[1]=0,c[2]=u}return d=(1-s)*a,[(s*c[0]+d)*255,(s*c[1]+d)*255,(s*c[2]+d)*255]},n.hcg.hsv=function(i){const r=i[1]/100,s=i[2]/100,a=r+s*(1-r);let c=0;return a>0&&(c=r/a),[i[0],c*100,a*100]},n.hcg.hsl=function(i){const r=i[1]/100,a=i[2]/100*(1-r)+.5*r;let c=0;return a>0&&a<.5?c=r/(2*a):a>=.5&&a<1&&(c=r/(2*(1-a))),[i[0],c*100,a*100]},n.hcg.hwb=function(i){const r=i[1]/100,s=i[2]/100,a=r+s*(1-r);return[i[0],(a-r)*100,(1-a)*100]},n.hwb.hcg=function(i){const r=i[1]/100,a=1-i[2]/100,c=a-r;let l=0;return c<1&&(l=(a-c)/(1-c)),[i[0],c*100,l*100]},n.apple.rgb=function(i){return[i[0]/65535*255,i[1]/65535*255,i[2]/65535*255]},n.rgb.apple=function(i){return[i[0]/255*65535,i[1]/255*65535,i[2]/255*65535]},n.gray.rgb=function(i){return[i[0]/100*255,i[0]/100*255,i[0]/100*255]},n.gray.hsl=function(i){return[0,0,i[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(i){return[0,100,i[0]]},n.gray.cmyk=function(i){return[0,0,0,i[0]]},n.gray.lab=function(i){return[i[0],0,0]},n.gray.hex=function(i){const r=Math.round(i[0]/100*255)&255,a=((r<<16)+(r<<8)+r).toString(16).toUpperCase();return"000000".substring(a.length)+a},n.rgb.gray=function(i){return[(i[0]+i[1]+i[2])/3/255*100]},EPe}var bPe,mbt;function nyo(){if(mbt)return bPe;mbt=1;const t=_bt();function e(){const r={},s=Object.keys(t);for(let a=s.length,c=0;c<a;c++)r[s[c]]={distance:-1,parent:null};return r}function n(r){const s=e(),a=[r];for(s[r].distance=0;a.length;){const c=a.pop(),l=Object.keys(t[c]);for(let A=l.length,u=0;u<A;u++){const d=l[u],_=s[d];_.distance===-1&&(_.distance=s[c].distance+1,_.parent=c,a.unshift(d))}}return s}function o(r,s){return function(a){return s(r(a))}}function i(r,s){const a=[s[r].parent,r];let c=t[s[r].parent][r],l=s[r].parent;for(;s[l].parent;)a.unshift(s[l].parent),c=o(t[s[l].parent][l],c),l=s[l].parent;return c.conversion=a,c}return bPe=function(r){const s=n(r),a={},c=Object.keys(s);for(let l=c.length,A=0;A<l;A++){const u=c[A];s[u].parent!==null&&(a[u]=i(u,s))}return a},bPe}var SPe,gbt;function oyo(){if(gbt)return SPe;gbt=1;const t=_bt(),e=nyo(),n={},o=Object.keys(t);function i(s){const a=function(...c){const l=c[0];return l==null?l:(l.length>1&&(c=l),s(c))};return"conversion"in s&&(a.conversion=s.conversion),a}function r(s){const a=function(...c){const l=c[0];if(l==null)return l;l.length>1&&(c=l);const A=s(c);if(typeof A=="object")for(let u=A.length,d=0;d<u;d++)A[d]=Math.round(A[d]);return A};return"conversion"in s&&(a.conversion=s.conversion),a}return o.forEach(s=>{n[s]={},Object.defineProperty(n[s],"channels",{value:t[s].channels}),Object.defineProperty(n[s],"labels",{value:t[s].labels});const a=e(s);Object.keys(a).forEach(l=>{const A=a[l];n[s][l]=r(A),n[s][l].raw=i(A)})}),SPe=n,SPe}var PPe,pbt;function iyo(){if(pbt)return PPe;pbt=1;const t=tyo(),e=oyo(),n=["keyword","gray","hex"],o={};for(const d of Object.keys(e))o[[...e[d].labels].sort().join("")]=d;const i={};function r(d,_){if(!(this instanceof r))return new r(d,_);if(_&&_ in n&&(_=null),_&&!(_ in e))throw new Error("Unknown model: "+_);let h,m;if(d==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(d instanceof r)this.model=d.model,this.color=[...d.color],this.valpha=d.valpha;else if(typeof d=="string"){const p=t.get(d);if(p===null)throw new Error("Unable to parse color from string: "+d);this.model=p.model,m=e[this.model].channels,this.color=p.value.slice(0,m),this.valpha=typeof p.value[m]=="number"?p.value[m]:1}else if(d.length>0){this.model=_||"rgb",m=e[this.model].channels;const p=Array.prototype.slice.call(d,0,m);this.color=u(p,m),this.valpha=typeof d[m]=="number"?d[m]:1}else if(typeof d=="number")this.model="rgb",this.color=[d>>16&255,d>>8&255,d&255],this.valpha=1;else{this.valpha=1;const p=Object.keys(d);"alpha"in d&&(p.splice(p.indexOf("alpha"),1),this.valpha=typeof d.alpha=="number"?d.alpha:0);const g=p.sort().join("");if(!(g in o))throw new Error("Unable to parse color from object: "+JSON.stringify(d));this.model=o[g];const{labels:f}=e[this.model],y=[];for(h=0;h<f.length;h++)y.push(d[f[h]]);this.color=u(y)}if(i[this.model])for(m=e[this.model].channels,h=0;h<m;h++){const p=i[this.model][h];p&&(this.color[h]=p(this.color[h]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}r.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(d){let _=this.model in t.to?this:this.rgb();_=_.round(typeof d=="number"?d:1);const h=_.valpha===1?_.color:[..._.color,this.valpha];return t.to[_.model](h)},percentString(d){const _=this.rgb().round(typeof d=="number"?d:1),h=_.valpha===1?_.color:[..._.color,this.valpha];return t.to.rgb.percent(h)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const d={},{channels:_}=e[this.model],{labels:h}=e[this.model];for(let m=0;m<_;m++)d[h[m]]=this.color[m];return this.valpha!==1&&(d.alpha=this.valpha),d},unitArray(){const d=this.rgb().color;return d[0]/=255,d[1]/=255,d[2]/=255,this.valpha!==1&&d.push(this.valpha),d},unitObject(){const d=this.rgb().object();return d.r/=255,d.g/=255,d.b/=255,this.valpha!==1&&(d.alpha=this.valpha),d},round(d){return d=Math.max(d||0,0),new r([...this.color.map(a(d)),this.valpha],this.model)},alpha(d){return d!==void 0?new r([...this.color,Math.max(0,Math.min(1,d))],this.model):this.valpha},red:c("rgb",0,l(255)),green:c("rgb",1,l(255)),blue:c("rgb",2,l(255)),hue:c(["hsl","hsv","hsl","hwb","hcg"],0,d=>(d%360+360)%360),saturationl:c("hsl",1,l(100)),lightness:c("hsl",2,l(100)),saturationv:c("hsv",1,l(100)),value:c("hsv",2,l(100)),chroma:c("hcg",1,l(100)),gray:c("hcg",2,l(100)),white:c("hwb",1,l(100)),wblack:c("hwb",2,l(100)),cyan:c("cmyk",0,l(100)),magenta:c("cmyk",1,l(100)),yellow:c("cmyk",2,l(100)),black:c("cmyk",3,l(100)),x:c("xyz",0,l(95.047)),y:c("xyz",1,l(100)),z:c("xyz",2,l(108.833)),l:c("lab",0,l(100)),a:c("lab",1),b:c("lab",2),keyword(d){return d!==void 0?new r(d):e[this.model].keyword(this.color)},hex(d){return d!==void 0?new r(d):t.to.hex(this.rgb().round().color)},hexa(d){if(d!==void 0)return new r(d);const _=this.rgb().round().color;let h=Math.round(this.valpha*255).toString(16).toUpperCase();return h.length===1&&(h="0"+h),t.to.hex(_)+h},rgbNumber(){const d=this.rgb().color;return(d[0]&255)<<16|(d[1]&255)<<8|d[2]&255},luminosity(){const d=this.rgb().color,_=[];for(const[h,m]of d.entries()){const p=m/255;_[h]=p<=.04045?p/12.92:((p+.055)/1.055)**2.4}return .2126*_[0]+.7152*_[1]+.0722*_[2]},contrast(d){const _=this.luminosity(),h=d.luminosity();return _>h?(_+.05)/(h+.05):(h+.05)/(_+.05)},level(d){const _=this.contrast(d);return _>=7?"AAA":_>=4.5?"AA":""},isDark(){const d=this.rgb().color;return(d[0]*2126+d[1]*7152+d[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const d=this.rgb();for(let _=0;_<3;_++)d.color[_]=255-d.color[_];return d},lighten(d){const _=this.hsl();return _.color[2]+=_.color[2]*d,_},darken(d){const _=this.hsl();return _.color[2]-=_.color[2]*d,_},saturate(d){const _=this.hsl();return _.color[1]+=_.color[1]*d,_},desaturate(d){const _=this.hsl();return _.color[1]-=_.color[1]*d,_},whiten(d){const _=this.hwb();return _.color[1]+=_.color[1]*d,_},blacken(d){const _=this.hwb();return _.color[2]+=_.color[2]*d,_},grayscale(){const d=this.rgb().color,_=d[0]*.3+d[1]*.59+d[2]*.11;return r.rgb(_,_,_)},fade(d){return this.alpha(this.valpha-this.valpha*d)},opaquer(d){return this.alpha(this.valpha+this.valpha*d)},rotate(d){const _=this.hsl();let h=_.color[0];return h=(h+d)%360,h=h<0?360+h:h,_.color[0]=h,_},mix(d,_){if(!d||!d.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof d);const h=d.rgb(),m=this.rgb(),p=_===void 0?.5:_,g=2*p-1,f=h.alpha()-m.alpha(),y=((g*f===-1?g:(g+f)/(1+g*f))+1)/2,C=1-y;return r.rgb(y*h.red()+C*m.red(),y*h.green()+C*m.green(),y*h.blue()+C*m.blue(),h.alpha()*p+m.alpha()*(1-p))}};for(const d of Object.keys(e)){if(n.includes(d))continue;const{channels:_}=e[d];r.prototype[d]=function(...h){return this.model===d?new r(this):h.length>0?new r(h,d):new r([...A(e[this.model][d].raw(this.color)),this.valpha],d)},r[d]=function(...h){let m=h[0];return typeof m=="number"&&(m=u(h,_)),new r(m,d)}}function s(d,_){return Number(d.toFixed(_))}function a(d){return function(_){return s(_,d)}}function c(d,_,h){d=Array.isArray(d)?d:[d];for(const m of d)(i[m]||(i[m]=[]))[_]=h;return d=d[0],function(m){let p;return m!==void 0?(h&&(m=h(m)),p=this[d](),p.color[_]=m,p):(p=this[d]().color[_],h&&(p=h(p)),p)}}function l(d){return function(_){return Math.max(0,Math.min(d,_))}}function A(d){return Array.isArray(d)?d:[d]}function u(d,_){for(let h=0;h<_;h++)typeof d[h]!="number"&&(d[h]=0);return d}return PPe=r,PPe}var ryo=iyo();const ml=f2(ryo);function So(t,e){return Array.isArray(e)?[t.a*e[0]+t.c*e[1]+t.e,t.b*e[0]+t.d*e[1]+t.f]:{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function syo(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function dO(t){return typeof t>"u"}function av(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function Nee(...t){t=Array.isArray(t[0])?t[0]:t;const e=(n,o)=>({a:n.a*o.a+n.c*o.b,c:n.a*o.c+n.c*o.d,e:n.a*o.e+n.c*o.f+n.e,b:n.b*o.a+n.d*o.b,d:n.b*o.c+n.d*o.d,f:n.b*o.e+n.d*o.f+n.f});switch(t.length){case 0:throw new Error("no matrices provided");case 1:return t[0];case 2:return e(t[0],t[1]);default:{const[n,o,...i]=t,r=e(n,o);return Nee(r,...i)}}}function vPe(...t){return Nee(...t)}const{cos:ayo,sin:cyo}=Math;function fbt(t,e,n){const o=ayo(t),i=cyo(t),r={a:o,c:-i,e:0,b:i,d:o,f:0};return dO(e)||dO(n)?r:Nee([av(e,n),r,av(-e,-n)])}function lyo(t,e=void 0,n=void 0,o=void 0){dO(e)&&(e=t);const i={a:t,c:0,e:0,b:0,d:e,f:0};return dO(n)||dO(o)?i:Nee([av(n,o),i,av(-n,-o)])}function kee(t){const{ctx:e,points:n,fill:o,stroke:i,strokeWidth:r=1,minStrokePx:s,realToCanvasMat:a,closePath:c=!1}=t;if(n.length<2)return;e.beginPath();const l=n.map(_=>So(a,[_.x,_.y])),A=l[0];if(!A)return;const[u,d]=A;e.moveTo(u,d);for(let _=1;_<l.length;_++){const h=l[_];if(!h)continue;const[m,p]=h;e.lineTo(m,p)}if(c&&e.closePath(),o&&(e.fillStyle=o,e.fill()),i){const _=r*Math.abs(a.a),h=s===void 0?_:Math.max(_,s);e.strokeStyle=i,e.lineWidth=h,e.stroke()}}function U_(t){const{ctx:e,center:n,width:o,height:i,fill:r,realToCanvasMat:s,borderRadius:a=0,ccwRotationDegrees:c=0,stroke:l,strokeWidth:A,isStrokeDashed:u=!1,lineJoin:d}=t,[_,h]=So(s,[n.x,n.y]),m=o*Math.abs(s.a),p=i*Math.abs(s.a),g=a*Math.abs(s.a),f=A?A*Math.abs(s.a):void 0;if(e.save(),e.translate(_,h),c!==0&&e.rotate(-c*(Math.PI/180)),e.beginPath(),g>0){const y=-m/2,C=-p/2,I=Math.min(g,m/2,p/2);e.moveTo(y+I,C),e.lineTo(y+m-I,C),e.arcTo(y+m,C,y+m,C+I,I),e.lineTo(y+m,C+p-I),e.arcTo(y+m,C+p,y+m-I,C+p,I),e.lineTo(y+I,C+p),e.arcTo(y,C+p,y,C+p-I,I),e.lineTo(y,C+I),e.arcTo(y,C,y+I,C,I)}else e.rect(-m/2,-p/2,m,p);r&&(e.fillStyle=r,e.fill()),l&&f&&(u?e.setLineDash([f*3,f*2]):e.setLineDash([]),d&&(e.lineJoin=d),e.strokeStyle=l,e.lineWidth=f,e.stroke()),e.restore()}function Ayo(t){const{ctx:e,board:n,realToCanvasMat:o,colorMap:i,drawBoardMaterial:r,minBoardOutlineStrokePx:s}=t,{width:a,height:c,center:l,outline:A}=n;if(A&&Array.isArray(A)&&A.length>=3){r&&kee({ctx:e,points:A.map(u=>({x:u.x,y:u.y})),fill:i.substrate,realToCanvasMat:o,closePath:!0}),kee({ctx:e,points:A.map(u=>({x:u.x,y:u.y})),stroke:i.boardOutline,strokeWidth:.1,realToCanvasMat:o,closePath:!0,minStrokePx:s});return}if(a!==void 0&&c!==void 0&&l){r&&U_({ctx:e,center:l,width:a,height:c,fill:i.substrate,realToCanvasMat:o});const u=a/2,d=c/2,_=[{x:l.x-u,y:l.y-d},{x:l.x+u,y:l.y-d},{x:l.x+u,y:l.y+d},{x:l.x-u,y:l.y+d}];kee({ctx:e,points:_,stroke:i.boardOutline,strokeWidth:.1,realToCanvasMat:o,closePath:!0,minStrokePx:s})}}function cv(t){const{ctx:e,points:n,fill:o,realToCanvasMat:i}=t;if(n.length<3)return;e.beginPath();const r=n.map(l=>So(i,[l.x,l.y])),s=r[0];if(!s)return;const[a,c]=s;e.moveTo(a,c);for(let l=1;l<r.length;l++){const A=r[l];if(!A)continue;const[u,d]=A;e.lineTo(u,d)}e.closePath(),e.fillStyle=o,e.fill()}function uyo(t,e){return e.copper[t]??e.copper.top}function dyo(t,e,n,o,i){if(Math.abs(i)<1e-10)return null;const r=n-t,s=o-e,a=Math.hypot(r,s);if(a<1e-10)return null;const c=Math.abs(i)*(a/2),l=a/2,A=(c*c+l*l)/(2*c),u=A-c,d=(t+n)/2,_=(e+o)/2,h=-s/a,m=r/a,p=i>0?-1:1,g=d+p*h*u,f=_+p*m*u;return{centerX:g,centerY:f,radius:A}}function BPe(t,e,n,o,i,r,s){if(Math.abs(r)<1e-10){const[C,I]=So(s,[o,i]);t.lineTo(C,I);return}const a=dyo(e,n,o,i,r);if(!a){const[C,I]=So(s,[o,i]);t.lineTo(C,I);return}const[c,l]=So(s,[e,n]),[A,u]=So(s,[o,i]),[d,_]=So(s,[a.centerX,a.centerY]),h=Math.hypot(c-d,l-_),m=Math.atan2(l-_,c-d),p=Math.atan2(u-_,A-d),f=s.a*s.d-s.b*s.c<0,y=r>0?!f:f;t.arc(d,_,h,m,p,y)}function ybt(t,e,n){if(e.vertices.length<2)return;if(e.vertices.length===2){const s=e.vertices[0],a=e.vertices[1];if(s&&a&&Math.abs((s.bulge??0)-1)<1e-10&&Math.abs((a.bulge??0)-1)<1e-10){const[c,l]=So(n,[s.x,s.y]);t.moveTo(c,l),BPe(t,s.x,s.y,a.x,a.y,1,n),BPe(t,a.x,a.y,s.x,s.y,1,n);return}}const o=e.vertices[0];if(!o)return;const[i,r]=So(n,[o.x,o.y]);t.moveTo(i,r);for(let s=0;s<e.vertices.length;s++){const a=e.vertices[s],c=(s+1)%e.vertices.length,l=e.vertices[c];if(!a||!l)continue;const A=a.bulge??0;if(Math.abs(A)<1e-10){const[u,d]=So(n,[l.x,l.y]);t.lineTo(u,d)}else BPe(t,a.x,a.y,l.x,l.y,A,n)}}function hyo(t){const{ctx:e,pour:n,realToCanvasMat:o,colorMap:i}=t,r=uyo(n.layer,i),s=.5;if(e.save(),e.globalAlpha=s,n.shape==="rect"){const[a,c]=So(o,[n.center.x,n.center.y]),l=n.width*Math.abs(o.a),A=n.height*Math.abs(o.a);e.translate(a,c),n.rotation&&e.rotate(-n.rotation*(Math.PI/180)),e.beginPath(),e.rect(-l/2,-A/2,l,A),e.fillStyle=r,e.fill(),e.restore();return}if(n.shape==="polygon"){if(n.points&&n.points.length>=3){const a=n.points.map(u=>So(o,[u.x,u.y])),c=a[0];if(!c){e.restore();return}e.beginPath();const[l,A]=c;e.moveTo(l,A);for(let u=1;u<a.length;u++){const d=a[u];if(!d)continue;const[_,h]=d;e.lineTo(_,h)}e.closePath(),e.fillStyle=r,e.fill()}e.restore();return}if(n.shape==="brep"){if(e.beginPath(),ybt(e,n.brep_shape.outer_ring,o),n.brep_shape.inner_rings)for(const a of n.brep_shape.inner_rings)ybt(e,a,o);e.fillStyle=r,e.fill("evenodd"),e.restore();return}e.restore()}function _yo(t,e){if(e.length<3)return;const n=e[0];if(n){t.moveTo(n.x,n.y);for(let o=1;o<e.length;o++){const i=e[o];i&&t.lineTo(i.x,i.y)}t.closePath()}}var myo=t=>Kgt[t]??(t===" "?Bf.spaceWidthRatio:Bf.glyphWidthRatio);function MPe(t,e,n){const o=myo(t),i=e?Bf.letterSpacingRatio:0,r=e?Wgt[t]?.[e]??0:0;return n*(o+i+r)}function gyo(t,e){const n=e*Bf.glyphWidthRatio,o=e*Bf.letterSpacingRatio,i=e*Bf.spaceWidthRatio,r=e*Bf.strokeWidthRatio,s=e*Bf.lineHeightRatio,a=t.replace(/\\n/g,`
|
|
5624
|
+
`,'"',l.BYTE_ORDER_MARK],l.WORKERS_SUPPORTED=!r&&!!o.Worker,l.NODE_STREAM_INPUT=1,l.LocalChunkSize=10485760,l.RemoteChunkSize=5242880,l.DefaultDelimiter=",",l.Parser=g,l.ParserHandle=m,l.NetworkStreamer=u,l.FileStreamer=d,l.StringStreamer=_,l.ReadableStreamStreamer=h,o.jQuery&&((i=o.jQuery).fn.parse=function(P){var B=P.config||{},M=[];return this.each(function(L){if(!(i(this).prop("tagName").toUpperCase()==="INPUT"&&i(this).attr("type").toLowerCase()==="file"&&o.FileReader)||!this.files||this.files.length===0)return!0;for(var F=0;F<this.files.length;F++)M.push({file:this.files[F],inputElem:this,instanceConfig:i.extend({},B)})}),k(),this;function k(){if(M.length===0)b(P.complete)&&P.complete();else{var L,F,G,W,j=M[0];if(b(P.before)){var $=P.before(j.file,j.inputElem);if(typeof $=="object"){if($.action==="abort")return L="AbortError",F=j.file,G=j.inputElem,W=$.reason,void(b(P.error)&&P.error({name:L},F,G,W));if($.action==="skip")return void N();typeof $.config=="object"&&(j.instanceConfig=i.extend(j.instanceConfig,$.config))}else if($==="skip")return void N()}var oe=j.instanceConfig.complete;j.instanceConfig.complete=function(le){b(oe)&&oe(le,j.file,j.inputElem),N()},l.parse(j.file,j.instanceConfig)}}function N(){M.splice(0,1),k()}}),s&&(o.onmessage=function(P){P=P.data,l.WORKER_ID===void 0&&P&&(l.WORKER_ID=P.workerId),typeof P.input=="string"?o.postMessage({workerId:l.WORKER_ID,results:l.parse(P.input,P.config),finished:!0}):(o.File&&P.input instanceof File||P.input instanceof Object)&&(P=l.parse(P.input,P.config))&&o.postMessage({workerId:l.WORKER_ID,results:P,finished:!0})}),(u.prototype=Object.create(A.prototype)).constructor=u,(d.prototype=Object.create(A.prototype)).constructor=d,(_.prototype=Object.create(_.prototype)).constructor=_,(h.prototype=Object.create(A.prototype)).constructor=h,l})})(Bee)),Bee.exports}var Q1o=D1o();const ZEt=f2(Q1o);var ebt=async({circuitJson:t,resolvePart:e})=>{const n=[];for(const o of t){if(o.type!=="pcb_component")continue;const i=t.find(l=>l.type==="source_component"&&l.source_component_id===o.source_component_id),r=t.find(l=>l.type==="cad_component"&&l.pcb_component_id===o.pcb_component_id);if(!i)continue;const s=await e?.({pcb_component:o,source_component:i})??{};let a="";i.ftype==="simple_resistor"&&(a=tbt(i.resistance)),i.ftype==="simple_capacitor"&&(a=tbt(i.capacitance));const c=!!o.do_not_place;n.push({designator:i.name??o.pcb_component_id,comment:c?"DNP":a,value:c?"DNP":a,footprint:s.footprint||r?.footprinter_string||"",supplier_part_number_columns:c?void 0:s.supplier_part_number_columns??(i.supplier_part_numbers?T1o(i.supplier_part_numbers):void 0)})}return n};function T1o(t){const e={};return t?.jlcpcb&&(e["JLCPCB Part #"]=t.jlcpcb[0]),t?.lcsc&&(e["JLCPCB Part #"]=t.lcsc[0]),e}function tbt(t){return t==null?"":typeof t=="string"?t:M1o.formatSI(t)}var R1o=t=>{const e=t.map(o=>{const i=o.supplier_part_number_columns;return Object.values(i||{}).join(", "),Object.entries(o.extra_columns||{}).map(([r,s])=>`${r}: ${s}`).join(", "),{Designator:o.designator,Comment:o.comment,Value:o.value,Footprint:o.footprint,...i}}),n=["Designator","Comment","Value","Footprint"];for(const o of e)for(const i in o)n.includes(i)||n.push(i);return ZEt.unparse(e,{columns:n})};const N1o=(t,e)=>K.jsx("a",{className:"rf-underline rf-text-blue-500",target:"_blank",rel:"noreferrer",href:`https://jlcpcb.com/partdetail/${e}`,children:e}),k1o=t=>t?.map(({manufacturer:e,mpn:n})=>`${e}: ${n}`).join(", "),H1o=t=>{const e=new Set;let n=!1,o=!1;for(const i of t){i.supplier_part_number_columns?.["JLCPCB Part #"]!==void 0&&(n=!0);for(const r of Object.keys(i.extra_columns??{}))e.add(r);(i.manufacturer_mpn_pairs?.length??0)>0&&(o=!0)}return{extraColumnNames:[...e],hasSupplierColumn:n,hasManufacturerColumn:o}},L1o=t=>{const e=[{key:"designator",label:"Designator",getCell:n=>n.designator},{key:"comment",label:"Comment",getCell:n=>n.comment},{key:"value",label:"Component Value",getCell:n=>n.value},{key:"footprint",label:"Footprint",getCell:n=>n.footprint}];t.hasSupplierColumn&&e.push({key:"supplier:JLCPCB Part #",label:"JLCPCB Part #",getCell:n=>{const o=n.supplier_part_number_columns?.["JLCPCB Part #"];return o?N1o("jlcpcb",o):""}}),t.hasManufacturerColumn&&e.push({key:"manufacturer_mpn_pairs",label:"Manufacturer / MPN",getCell:n=>k1o(n.manufacturer_mpn_pairs)});for(const n of t.extraColumnNames)e.push({key:`extra:${n}`,label:n,getCell:o=>o.extra_columns?.[n]||""});return e},F1o=({circuitJson:t})=>{const[e,n]=J.useState(null),[o,i]=J.useState(null);if(J.useEffect(()=>{let a=!1;return(async()=>{try{i(null),n(null);const l=await ebt({circuitJson:t});a||n(l)}catch(l){a||i(l instanceof Error?l.message:"Unknown BOM error")}})(),()=>{a=!0}},[t]),o)throw new Error(o);const r=H1o(e??[]),s=L1o(r);return e?K.jsx("div",{className:"rf-overflow-x-auto",children:K.jsxs("table",{className:"rf-w-full rf-text-left rf-text-sm",children:[K.jsx("thead",{children:K.jsx("tr",{className:"rf-border-b",children:s.map(a=>K.jsx("th",{className:"rf-p-2",children:a.label},a.key))})}),K.jsx("tbody",{children:e.map((a,c)=>K.jsx("tr",{className:"rf-border-b",children:s.map(l=>K.jsx("td",{className:"rf-p-2",children:l.getCell(a)},l.key))},a.designator||`${c}`))})]})}):K.jsx("div",{className:"rf-p-4 rf-text-sm rf-text-muted-foreground",children:"Loading BOM..."})},mPe=J.forwardRef(({className:t,type:e,...n},o)=>K.jsx("input",{type:e,className:Li("rf-flex rf-h-9 rf-w-full rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-px-3 rf-py-1 rf-text-sm rf-shadow-sm rf-transition-colors file:rf-border-0 file:rf-bg-transparent file:rf-text-sm file:rf-font-medium placeholder:rf-text-zinc-500 focus-visible:rf-outline-none focus-visible:rf-ring-1 focus-visible:rf-ring-zinc-950 disabled:rf-cursor-not-allowed disabled:rf-opacity-50 dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-placeholder-zinc-400 dark:focus-visible:rf-ring-zinc-300",t),ref:o,...n}));mPe.displayName="Input";const lO=t=>typeof t=="number"&&!isNaN(t),K8=t=>typeof t=="string",wx=t=>typeof t=="function",Mee=t=>K8(t)||wx(t)?t:null,gPe=t=>J.isValidElement(t)||K8(t)||wx(t)||lO(t);function O1o(t,e,n){n===void 0&&(n=300);const{scrollHeight:o,style:i}=t;requestAnimationFrame(()=>{i.minHeight="initial",i.height=o+"px",i.transition=`all ${n}ms`,requestAnimationFrame(()=>{i.height="0",i.padding="0",i.margin="0",setTimeout(e,n)})})}function wee(t){let{enter:e,exit:n,appendPosition:o=!1,collapse:i=!0,collapseDuration:r=300}=t;return function(s){let{children:a,position:c,preventExitTransition:l,done:A,nodeRef:u,isIn:d,playToast:_}=s;const h=o?`${e}--${c}`:e,m=o?`${n}--${c}`:n,p=J.useRef(0);return J.useLayoutEffect(()=>{const g=u.current,f=h.split(" "),y=C=>{C.target===u.current&&(_(),g.removeEventListener("animationend",y),g.removeEventListener("animationcancel",y),p.current===0&&C.type!=="animationcancel"&&g.classList.remove(...f))};g.classList.add(...f),g.addEventListener("animationend",y),g.addEventListener("animationcancel",y)},[]),J.useEffect(()=>{const g=u.current,f=()=>{g.removeEventListener("animationend",f),i?O1o(g,A,r):A()};d||(l?f():(p.current=1,g.className+=` ${m}`,g.addEventListener("animationend",f)))},[d]),lr.createElement(lr.Fragment,null,a)}}function nbt(t,e){return t!=null?{content:t.content,containerId:t.props.containerId,id:t.props.toastId,theme:t.props.theme,type:t.props.type,data:t.props.data||{},isLoading:t.props.isLoading,icon:t.props.icon,status:e}:{}}const F1=new Map;let AO=[];const pPe=new Set,G1o=t=>pPe.forEach(e=>e(t)),obt=()=>F1.size>0;function ibt(t,e){var n;if(e)return!((n=F1.get(e))==null||!n.isToastActive(t));let o=!1;return F1.forEach(i=>{i.isToastActive(t)&&(o=!0)}),o}function rbt(t,e){gPe(t)&&(obt()||AO.push({content:t,options:e}),F1.forEach(n=>{n.buildToast(t,e)}))}function sbt(t,e){F1.forEach(n=>{e!=null&&e!=null&&e.containerId?e?.containerId===n.id&&n.toggle(t,e?.id):n.toggle(t,e?.id)})}function U1o(t){const{subscribe:e,getSnapshot:n,setProps:o}=J.useRef((function(r){const s=r.containerId||1;return{subscribe(a){const c=(function(A,u,d){let _=1,h=0,m=[],p=[],g=[],f=u;const y=new Map,C=new Set,I=()=>{g=Array.from(y.values()),C.forEach(P=>P())},E=P=>{p=P==null?[]:p.filter(B=>B!==P),I()},b=P=>{const{toastId:B,onOpen:M,updateId:k,children:N}=P.props,L=k==null;P.staleId&&y.delete(P.staleId),y.set(B,P),p=[...p,P.props.toastId].filter(F=>F!==P.staleId),I(),d(nbt(P,L?"added":"updated")),L&&wx(M)&&M(J.isValidElement(N)&&N.props)};return{id:A,props:f,observe:P=>(C.add(P),()=>C.delete(P)),toggle:(P,B)=>{y.forEach(M=>{B!=null&&B!==M.props.toastId||wx(M.toggle)&&M.toggle(P)})},removeToast:E,toasts:y,clearQueue:()=>{h-=m.length,m=[]},buildToast:(P,B)=>{if((ie=>{let{containerId:ae,toastId:re,updateId:ue}=ie;const ye=ae?ae!==A:A!==1,be=y.has(re)&&ue==null;return ye||be})(B))return;const{toastId:M,updateId:k,data:N,staleId:L,delay:F}=B,G=()=>{E(M)},W=k==null;W&&h++;const j={...f,style:f.toastStyle,key:_++,...Object.fromEntries(Object.entries(B).filter(ie=>{let[ae,re]=ie;return re!=null})),toastId:M,updateId:k,data:N,closeToast:G,isIn:!1,className:Mee(B.className||f.toastClassName),bodyClassName:Mee(B.bodyClassName||f.bodyClassName),progressClassName:Mee(B.progressClassName||f.progressClassName),autoClose:!B.isLoading&&($=B.autoClose,oe=f.autoClose,$===!1||lO($)&&$>0?$:oe),deleteToast(){const ie=y.get(M),{onClose:ae,children:re}=ie.props;wx(ae)&&ae(J.isValidElement(re)&&re.props),d(nbt(ie,"removed")),y.delete(M),h--,h<0&&(h=0),m.length>0?b(m.shift()):I()}};var $,oe;j.closeButton=f.closeButton,B.closeButton===!1||gPe(B.closeButton)?j.closeButton=B.closeButton:B.closeButton===!0&&(j.closeButton=!gPe(f.closeButton)||f.closeButton);let le=P;J.isValidElement(P)&&!K8(P.type)?le=J.cloneElement(P,{closeToast:G,toastProps:j,data:N}):wx(P)&&(le=P({closeToast:G,toastProps:j,data:N}));const ee={content:le,props:j,staleId:L};f.limit&&f.limit>0&&h>f.limit&&W?m.push(ee):lO(F)?setTimeout(()=>{b(ee)},F):b(ee)},setProps(P){f=P},setToggle:(P,B)=>{y.get(P).toggle=B},isToastActive:P=>p.some(B=>B===P),getSnapshot:()=>g}})(s,r,G1o);F1.set(s,c);const l=c.observe(a);return AO.forEach(A=>rbt(A.content,A.options)),AO=[],()=>{l(),F1.delete(s)}},setProps(a){var c;(c=F1.get(s))==null||c.setProps(a)},getSnapshot(){var a;return(a=F1.get(s))==null?void 0:a.getSnapshot()}}})(t)).current;o(t);const i=J.useSyncExternalStore(e,n,n);return{getToastToRender:function(r){if(!i)return[];const s=new Map;return t.newestOnTop&&i.reverse(),i.forEach(a=>{const{position:c}=a.props;s.has(c)||s.set(c,[]),s.get(c).push(a)}),Array.from(s,a=>r(a[0],a[1]))},isToastActive:ibt,count:i?.length}}function z1o(t){const[e,n]=J.useState(!1),[o,i]=J.useState(!1),r=J.useRef(null),s=J.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:a,pauseOnHover:c,closeToast:l,onClick:A,closeOnClick:u}=t;var d,_;function h(){n(!0)}function m(){n(!1)}function p(y){const C=r.current;s.canDrag&&C&&(s.didMove=!0,e&&m(),s.delta=t.draggableDirection==="x"?y.clientX-s.start:y.clientY-s.start,s.start!==y.clientX&&(s.canCloseOnClick=!1),C.style.transform=`translate3d(${t.draggableDirection==="x"?`${s.delta}px, var(--y)`:`0, calc(${s.delta}px + var(--y))`},0)`,C.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function g(){document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",g);const y=r.current;if(s.canDrag&&s.didMove&&y){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance)return i(!0),t.closeToast(),void t.collapseAll();y.style.transition="transform 0.2s, opacity 0.2s",y.style.removeProperty("transform"),y.style.removeProperty("opacity")}}(_=F1.get((d={id:t.toastId,containerId:t.containerId,fn:n}).containerId||1))==null||_.setToggle(d.id,d.fn),J.useEffect(()=>{if(t.pauseOnFocusLoss)return document.hasFocus()||m(),window.addEventListener("focus",h),window.addEventListener("blur",m),()=>{window.removeEventListener("focus",h),window.removeEventListener("blur",m)}},[t.pauseOnFocusLoss]);const f={onPointerDown:function(y){if(t.draggable===!0||t.draggable===y.pointerType){s.didMove=!1,document.addEventListener("pointermove",p),document.addEventListener("pointerup",g);const C=r.current;s.canCloseOnClick=!0,s.canDrag=!0,C.style.transition="none",t.draggableDirection==="x"?(s.start=y.clientX,s.removalDistance=C.offsetWidth*(t.draggablePercent/100)):(s.start=y.clientY,s.removalDistance=C.offsetHeight*(t.draggablePercent===80?1.5*t.draggablePercent:t.draggablePercent)/100)}},onPointerUp:function(y){const{top:C,bottom:I,left:E,right:b}=r.current.getBoundingClientRect();y.nativeEvent.type!=="touchend"&&t.pauseOnHover&&y.clientX>=E&&y.clientX<=b&&y.clientY>=C&&y.clientY<=I?m():h()}};return a&&c&&(f.onMouseEnter=m,t.stacked||(f.onMouseLeave=h)),u&&(f.onClick=y=>{A&&A(y),s.canCloseOnClick&&l()}),{playToast:h,pauseToast:m,isRunning:e,preventExitTransition:o,toastRef:r,eventHandlers:f}}function V1o(t){let{delay:e,isRunning:n,closeToast:o,type:i="default",hide:r,className:s,style:a,controlledProgress:c,progress:l,rtl:A,isIn:u,theme:d}=t;const _=r||c&&l===0,h={...a,animationDuration:`${e}ms`,animationPlayState:n?"running":"paused"};c&&(h.transform=`scaleX(${l})`);const m=VI("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${d}`,`Toastify__progress-bar--${i}`,{"Toastify__progress-bar--rtl":A}),p=wx(s)?s({rtl:A,type:i,defaultClassName:m}):VI(m,s),g={[c&&l>=1?"onTransitionEnd":"onAnimationEnd"]:c&&l<1?null:()=>{u&&o()}};return lr.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":_},lr.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${d} Toastify__progress-bar--${i}`}),lr.createElement("div",{role:"progressbar","aria-hidden":_?"true":"false","aria-label":"notification timer",className:p,style:h,...g}))}let Y1o=1;const abt=()=>""+Y1o++;function K1o(t){return t&&(K8(t.toastId)||lO(t.toastId))?t.toastId:abt()}function uO(t,e){return rbt(t,e),e.toastId}function Dee(t,e){return{...e,type:e&&e.type||t,toastId:K1o(e)}}function Qee(t){return(e,n)=>uO(e,Dee(t,n))}function KA(t,e){return uO(t,Dee("default",e))}KA.loading=(t,e)=>uO(t,Dee("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...e})),KA.promise=function(t,e,n){let o,{pending:i,error:r,success:s}=e;i&&(o=K8(i)?KA.loading(i,n):KA.loading(i.render,{...n,...i}));const a={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},c=(A,u,d)=>{if(u==null)return void KA.dismiss(o);const _={type:A,...a,...n,data:d},h=K8(u)?{render:u}:u;return o?KA.update(o,{..._,...h}):KA(h.render,{..._,...h}),d},l=wx(t)?t():t;return l.then(A=>c("success",s,A)).catch(A=>c("error",r,A)),l},KA.success=Qee("success"),KA.info=Qee("info"),KA.error=Qee("error"),KA.warning=Qee("warning"),KA.warn=KA.warning,KA.dark=(t,e)=>uO(t,Dee("default",{theme:"dark",...e})),KA.dismiss=function(t){(function(e){var n;if(obt()){if(e==null||K8(n=e)||lO(n))F1.forEach(o=>{o.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){const o=F1.get(e.containerId);o?o.removeToast(e.id):F1.forEach(i=>{i.removeToast(e.id)})}}else AO=AO.filter(o=>e!=null&&o.options.toastId!==e)})(t)},KA.clearWaitingQueue=function(t){t===void 0&&(t={}),F1.forEach(e=>{!e.props.limit||t.containerId&&e.id!==t.containerId||e.clearQueue()})},KA.isActive=ibt,KA.update=function(t,e){e===void 0&&(e={});const n=((o,i)=>{var r;let{containerId:s}=i;return(r=F1.get(s||1))==null?void 0:r.toasts.get(o)})(t,e);if(n){const{props:o,content:i}=n,r={delay:100,...o,...e,toastId:e.toastId||t,updateId:abt()};r.toastId!==t&&(r.staleId=t);const s=r.render||i;delete r.render,uO(s,r)}},KA.done=t=>{KA.update(t,{progress:1})},KA.onChange=function(t){return pPe.add(t),()=>{pPe.delete(t)}},KA.play=t=>sbt(!0,t),KA.pause=t=>sbt(!1,t);const W1o=typeof window<"u"?J.useLayoutEffect:J.useEffect,Tee=t=>{let{theme:e,type:n,isLoading:o,...i}=t;return lr.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${n})`,...i})},fPe={info:function(t){return lr.createElement(Tee,{...t},lr.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(t){return lr.createElement(Tee,{...t},lr.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(t){return lr.createElement(Tee,{...t},lr.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(t){return lr.createElement(Tee,{...t},lr.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return lr.createElement("div",{className:"Toastify__spinner"})}},j1o=t=>{const{isRunning:e,preventExitTransition:n,toastRef:o,eventHandlers:i,playToast:r}=z1o(t),{closeButton:s,children:a,autoClose:c,onClick:l,type:A,hideProgressBar:u,closeToast:d,transition:_,position:h,className:m,style:p,bodyClassName:g,bodyStyle:f,progressClassName:y,progressStyle:C,updateId:I,role:E,progress:b,rtl:P,toastId:B,deleteToast:M,isIn:k,isLoading:N,closeOnClick:L,theme:F}=t,G=VI("Toastify__toast",`Toastify__toast-theme--${F}`,`Toastify__toast--${A}`,{"Toastify__toast--rtl":P},{"Toastify__toast--close-on-click":L}),W=wx(m)?m({rtl:P,position:h,type:A,defaultClassName:G}):VI(G,m),j=(function(ee){let{theme:ie,type:ae,isLoading:re,icon:ue}=ee,ye=null;const be={theme:ie,type:ae};return ue===!1||(wx(ue)?ye=ue({...be,isLoading:re}):J.isValidElement(ue)?ye=J.cloneElement(ue,be):re?ye=fPe.spinner():(ve=>ve in fPe)(ae)&&(ye=fPe[ae](be))),ye})(t),$=!!b||!c,oe={closeToast:d,type:A,theme:F};let le=null;return s===!1||(le=wx(s)?s(oe):J.isValidElement(s)?J.cloneElement(s,oe):(function(ee){let{closeToast:ie,theme:ae,ariaLabel:re="close"}=ee;return lr.createElement("button",{className:`Toastify__close-button Toastify__close-button--${ae}`,type:"button",onClick:ue=>{ue.stopPropagation(),ie(ue)},"aria-label":re},lr.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},lr.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))})(oe)),lr.createElement(_,{isIn:k,done:M,position:h,preventExitTransition:n,nodeRef:o,playToast:r},lr.createElement("div",{id:B,onClick:l,"data-in":k,className:W,...i,style:p,ref:o},lr.createElement("div",{...k&&{role:E},className:wx(g)?g({type:A}):VI("Toastify__toast-body",g),style:f},j!=null&&lr.createElement("div",{className:VI("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!N})},j),lr.createElement("div",null,a)),le,lr.createElement(V1o,{...I&&!$?{key:`pb-${I}`}:{},rtl:P,theme:F,delay:c,isRunning:e,isIn:k,closeToast:d,hide:u,type:A,style:C,className:y,controlledProgress:$,progress:b||0})))},Ree=function(t,e){return e===void 0&&(e=!1),{enter:`Toastify--animate Toastify__${t}-enter`,exit:`Toastify--animate Toastify__${t}-exit`,appendPosition:e}},X1o=wee(Ree("bounce",!0));wee(Ree("slide",!0)),wee(Ree("zoom")),wee(Ree("flip"));const J1o={position:"top-right",transition:X1o,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function q1o(t){let e={...J1o,...t};const n=t.stacked,[o,i]=J.useState(!0),r=J.useRef(null),{getToastToRender:s,isToastActive:a,count:c}=U1o(e),{className:l,style:A,rtl:u,containerId:d}=e;function _(m){const p=VI("Toastify__toast-container",`Toastify__toast-container--${m}`,{"Toastify__toast-container--rtl":u});return wx(l)?l({position:m,rtl:u,defaultClassName:p}):VI(p,Mee(l))}function h(){n&&(i(!0),KA.play())}return W1o(()=>{if(n){var m;const p=r.current.querySelectorAll('[data-in="true"]'),g=12,f=(m=e.position)==null?void 0:m.includes("top");let y=0,C=0;Array.from(p).reverse().forEach((I,E)=>{const b=I;b.classList.add("Toastify__toast--stacked"),E>0&&(b.dataset.collapsed=`${o}`),b.dataset.pos||(b.dataset.pos=f?"top":"bot");const P=y*(o?.2:1)+(o?0:g*E);b.style.setProperty("--y",`${f?P:-1*P}px`),b.style.setProperty("--g",`${g}`),b.style.setProperty("--s",""+(1-(o?C:0))),y+=b.offsetHeight,C+=.025})}},[o,c,n]),lr.createElement("div",{ref:r,className:"Toastify",id:d,onMouseEnter:()=>{n&&(i(!1),KA.pause())},onMouseLeave:h},s((m,p)=>{const g=p.length?{...A}:{...A,pointerEvents:"none"};return lr.createElement("div",{className:_(m),style:g,key:`container-${m}`},p.map(f=>{let{content:y,props:C}=f;return lr.createElement(j1o,{...C,stacked:n,collapseAll:h,isIn:a(C.toastId,C.containerId),style:C.style,key:`toast-${C.key}`},y)}))}))}function $1o(){var t=':root{--toastify-color-light:#fff;--toastify-color-dark:#121212;--toastify-color-info:#3498db;--toastify-color-success:#07bc0c;--toastify-color-warning:#f1c40f;--toastify-color-error:#e74c3c;--toastify-color-transparent:hsla(0,0%,100%,.7);--toastify-icon-color-info:var(--toastify-color-info);--toastify-icon-color-success:var(--toastify-color-success);--toastify-icon-color-warning:var(--toastify-color-warning);--toastify-icon-color-error:var(--toastify-color-error);--toastify-toast-width:320px;--toastify-toast-offset:16px;--toastify-toast-top:max(var(--toastify-toast-offset),env(safe-area-inset-top));--toastify-toast-right:max(var(--toastify-toast-offset),env(safe-area-inset-right));--toastify-toast-left:max(var(--toastify-toast-offset),env(safe-area-inset-left));--toastify-toast-bottom:max(var(--toastify-toast-offset),env(safe-area-inset-bottom));--toastify-toast-background:#fff;--toastify-toast-min-height:64px;--toastify-toast-max-height:800px;--toastify-toast-bd-radius:6px;--toastify-font-family:sans-serif;--toastify-z-index:9999;--toastify-text-color-light:#757575;--toastify-text-color-dark:#fff;--toastify-text-color-info:#fff;--toastify-text-color-success:#fff;--toastify-text-color-warning:#fff;--toastify-text-color-error:#fff;--toastify-spinner-color:#616161;--toastify-spinner-color-empty-area:#e0e0e0;--toastify-color-progress-light:linear-gradient(90deg,#4cd964,#5ac8fa,#007aff,#34aadc,#5856d6,#ff2d55);--toastify-color-progress-dark:#bb86fc;--toastify-color-progress-info:var(--toastify-color-info);--toastify-color-progress-success:var(--toastify-color-success);--toastify-color-progress-warning:var(--toastify-color-warning);--toastify-color-progress-error:var(--toastify-color-error);--toastify-color-progress-bgo:0.2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translateZ(var(--toastify-z-index));position:fixed;padding:4px;width:var(--toastify-toast-width);box-sizing:border-box;color:#fff}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translateX(-50%)}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right)}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translateX(-50%)}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right)}@media only screen and (max-width:480px){.Toastify__toast-container{width:100vw;padding:0;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-center,.Toastify__toast-container--top-left,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translateX(0)}.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translateX(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:auto}}.Toastify__toast{--y:0;position:relative;-ms-touch-action:none;touch-action:none;min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:8px;border-radius:var(--toastify-toast-bd-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);cursor:default;direction:ltr;z-index:0;overflow:hidden}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__close-button,.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-body{margin:auto 0;-ms-flex:1 1 auto;flex:1 1 auto;padding:6px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.Toastify__toast-body>div:last-child{word-break:break-word;-ms-flex:1;flex:1}.Toastify__toast-icon{-webkit-margin-end:10px;margin-inline-end:10px;width:20px;-ms-flex-negative:0;flex-shrink:0;display:-ms-flexbox;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}@media only screen and (max-width:480px){.Toastify__toast{margin-bottom:0;border-radius:0}}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--colored.Toastify__toast--default,.Toastify__toast-theme--light{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;-ms-flex-item-align:start;align-self:flex-start;z-index:1}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:focus,.Toastify__close-button:hover{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:var(--toastify-z-index);opacity:.7;transform-origin:left;border-bottom-left-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:auto;transform-origin:right;border-bottom-left-radius:0;border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp{position:absolute;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--bottom-left,.Toastify__bounce-enter--top-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--bottom-right,.Toastify__bounce-enter--top-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--bottom-left,.Toastify__bounce-exit--top-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--bottom-right,.Toastify__bounce-exit--top-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--bottom-left,.Toastify__slide-enter--top-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--bottom-right,.Toastify__slide-enter--top-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--bottom-left,.Toastify__slide-exit--top-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-right,.Toastify__slide-exit--top-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}',e=document.createElement("style");e.innerText=t,document.head.appendChild(e)}var yPe={exports:{}},CPe,cbt;function lbt(){return cbt||(cbt=1,CPe={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),CPe}var xPe={exports:{}},IPe,Abt;function Z1o(){return Abt||(Abt=1,IPe=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")}),IPe}var ubt;function eyo(){if(ubt)return xPe.exports;ubt=1;var t=Z1o(),e=Array.prototype.concat,n=Array.prototype.slice,o=xPe.exports=function(r){for(var s=[],a=0,c=r.length;a<c;a++){var l=r[a];t(l)?s=e.call(s,n.call(l)):s.push(l)}return s};return o.wrap=function(i){return function(){return i(o(arguments))}},xPe.exports}var dbt;function tyo(){if(dbt)return yPe.exports;dbt=1;var t=lbt(),e=eyo(),n=Object.hasOwnProperty,o=Object.create(null);for(var i in t)n.call(t,i)&&(o[t[i]]=i);var r=yPe.exports={to:{},get:{}};r.get=function(c){var l=c.substring(0,3).toLowerCase(),A,u;switch(l){case"hsl":A=r.get.hsl(c),u="hsl";break;case"hwb":A=r.get.hwb(c),u="hwb";break;default:A=r.get.rgb(c),u="rgb";break}return A?{model:u,value:A}:null},r.get.rgb=function(c){if(!c)return null;var l=/^#([a-f0-9]{3,4})$/i,A=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,u=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,d=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,_=/^(\w+)$/,h=[0,0,0,1],m,p,g;if(m=c.match(A)){for(g=m[2],m=m[1],p=0;p<3;p++){var f=p*2;h[p]=parseInt(m.slice(f,f+2),16)}g&&(h[3]=parseInt(g,16)/255)}else if(m=c.match(l)){for(m=m[1],g=m[3],p=0;p<3;p++)h[p]=parseInt(m[p]+m[p],16);g&&(h[3]=parseInt(g+g,16)/255)}else if(m=c.match(u)){for(p=0;p<3;p++)h[p]=parseInt(m[p+1],0);m[4]&&(m[5]?h[3]=parseFloat(m[4])*.01:h[3]=parseFloat(m[4]))}else if(m=c.match(d)){for(p=0;p<3;p++)h[p]=Math.round(parseFloat(m[p+1])*2.55);m[4]&&(m[5]?h[3]=parseFloat(m[4])*.01:h[3]=parseFloat(m[4]))}else return(m=c.match(_))?m[1]==="transparent"?[0,0,0,0]:n.call(t,m[1])?(h=t[m[1]],h[3]=1,h):null:null;for(p=0;p<3;p++)h[p]=s(h[p],0,255);return h[3]=s(h[3],0,1),h},r.get.hsl=function(c){if(!c)return null;var l=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,A=c.match(l);if(A){var u=parseFloat(A[4]),d=(parseFloat(A[1])%360+360)%360,_=s(parseFloat(A[2]),0,100),h=s(parseFloat(A[3]),0,100),m=s(isNaN(u)?1:u,0,1);return[d,_,h,m]}return null},r.get.hwb=function(c){if(!c)return null;var l=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,A=c.match(l);if(A){var u=parseFloat(A[4]),d=(parseFloat(A[1])%360+360)%360,_=s(parseFloat(A[2]),0,100),h=s(parseFloat(A[3]),0,100),m=s(isNaN(u)?1:u,0,1);return[d,_,h,m]}return null},r.to.hex=function(){var c=e(arguments);return"#"+a(c[0])+a(c[1])+a(c[2])+(c[3]<1?a(Math.round(c[3]*255)):"")},r.to.rgb=function(){var c=e(arguments);return c.length<4||c[3]===1?"rgb("+Math.round(c[0])+", "+Math.round(c[1])+", "+Math.round(c[2])+")":"rgba("+Math.round(c[0])+", "+Math.round(c[1])+", "+Math.round(c[2])+", "+c[3]+")"},r.to.rgb.percent=function(){var c=e(arguments),l=Math.round(c[0]/255*100),A=Math.round(c[1]/255*100),u=Math.round(c[2]/255*100);return c.length<4||c[3]===1?"rgb("+l+"%, "+A+"%, "+u+"%)":"rgba("+l+"%, "+A+"%, "+u+"%, "+c[3]+")"},r.to.hsl=function(){var c=e(arguments);return c.length<4||c[3]===1?"hsl("+c[0]+", "+c[1]+"%, "+c[2]+"%)":"hsla("+c[0]+", "+c[1]+"%, "+c[2]+"%, "+c[3]+")"},r.to.hwb=function(){var c=e(arguments),l="";return c.length>=4&&c[3]!==1&&(l=", "+c[3]),"hwb("+c[0]+", "+c[1]+"%, "+c[2]+"%"+l+")"},r.to.keyword=function(c){return o[c.slice(0,3)]};function s(c,l,A){return Math.min(Math.max(l,c),A)}function a(c){var l=Math.round(c).toString(16).toUpperCase();return l.length<2?"0"+l:l}return yPe.exports}var EPe,hbt;function _bt(){if(hbt)return EPe;hbt=1;const t=lbt(),e={};for(const i of Object.keys(t))e[t[i]]=i;const n={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};EPe=n;for(const i of Object.keys(n)){if(!("channels"in n[i]))throw new Error("missing channels property: "+i);if(!("labels"in n[i]))throw new Error("missing channel labels property: "+i);if(n[i].labels.length!==n[i].channels)throw new Error("channel and label counts mismatch: "+i);const{channels:r,labels:s}=n[i];delete n[i].channels,delete n[i].labels,Object.defineProperty(n[i],"channels",{value:r}),Object.defineProperty(n[i],"labels",{value:s})}n.rgb.hsl=function(i){const r=i[0]/255,s=i[1]/255,a=i[2]/255,c=Math.min(r,s,a),l=Math.max(r,s,a),A=l-c;let u,d;l===c?u=0:r===l?u=(s-a)/A:s===l?u=2+(a-r)/A:a===l&&(u=4+(r-s)/A),u=Math.min(u*60,360),u<0&&(u+=360);const _=(c+l)/2;return l===c?d=0:_<=.5?d=A/(l+c):d=A/(2-l-c),[u,d*100,_*100]},n.rgb.hsv=function(i){let r,s,a,c,l;const A=i[0]/255,u=i[1]/255,d=i[2]/255,_=Math.max(A,u,d),h=_-Math.min(A,u,d),m=function(p){return(_-p)/6/h+1/2};return h===0?(c=0,l=0):(l=h/_,r=m(A),s=m(u),a=m(d),A===_?c=a-s:u===_?c=1/3+r-a:d===_&&(c=2/3+s-r),c<0?c+=1:c>1&&(c-=1)),[c*360,l*100,_*100]},n.rgb.hwb=function(i){const r=i[0],s=i[1];let a=i[2];const c=n.rgb.hsl(i)[0],l=1/255*Math.min(r,Math.min(s,a));return a=1-1/255*Math.max(r,Math.max(s,a)),[c,l*100,a*100]},n.rgb.cmyk=function(i){const r=i[0]/255,s=i[1]/255,a=i[2]/255,c=Math.min(1-r,1-s,1-a),l=(1-r-c)/(1-c)||0,A=(1-s-c)/(1-c)||0,u=(1-a-c)/(1-c)||0;return[l*100,A*100,u*100,c*100]};function o(i,r){return(i[0]-r[0])**2+(i[1]-r[1])**2+(i[2]-r[2])**2}return n.rgb.keyword=function(i){const r=e[i];if(r)return r;let s=1/0,a;for(const c of Object.keys(t)){const l=t[c],A=o(i,l);A<s&&(s=A,a=c)}return a},n.keyword.rgb=function(i){return t[i]},n.rgb.xyz=function(i){let r=i[0]/255,s=i[1]/255,a=i[2]/255;r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92,a=a>.04045?((a+.055)/1.055)**2.4:a/12.92;const c=r*.4124+s*.3576+a*.1805,l=r*.2126+s*.7152+a*.0722,A=r*.0193+s*.1192+a*.9505;return[c*100,l*100,A*100]},n.rgb.lab=function(i){const r=n.rgb.xyz(i);let s=r[0],a=r[1],c=r[2];s/=95.047,a/=100,c/=108.883,s=s>.008856?s**(1/3):7.787*s+16/116,a=a>.008856?a**(1/3):7.787*a+16/116,c=c>.008856?c**(1/3):7.787*c+16/116;const l=116*a-16,A=500*(s-a),u=200*(a-c);return[l,A,u]},n.hsl.rgb=function(i){const r=i[0]/360,s=i[1]/100,a=i[2]/100;let c,l,A;if(s===0)return A=a*255,[A,A,A];a<.5?c=a*(1+s):c=a+s-a*s;const u=2*a-c,d=[0,0,0];for(let _=0;_<3;_++)l=r+1/3*-(_-1),l<0&&l++,l>1&&l--,6*l<1?A=u+(c-u)*6*l:2*l<1?A=c:3*l<2?A=u+(c-u)*(2/3-l)*6:A=u,d[_]=A*255;return d},n.hsl.hsv=function(i){const r=i[0];let s=i[1]/100,a=i[2]/100,c=s;const l=Math.max(a,.01);a*=2,s*=a<=1?a:2-a,c*=l<=1?l:2-l;const A=(a+s)/2,u=a===0?2*c/(l+c):2*s/(a+s);return[r,u*100,A*100]},n.hsv.rgb=function(i){const r=i[0]/60,s=i[1]/100;let a=i[2]/100;const c=Math.floor(r)%6,l=r-Math.floor(r),A=255*a*(1-s),u=255*a*(1-s*l),d=255*a*(1-s*(1-l));switch(a*=255,c){case 0:return[a,d,A];case 1:return[u,a,A];case 2:return[A,a,d];case 3:return[A,u,a];case 4:return[d,A,a];case 5:return[a,A,u]}},n.hsv.hsl=function(i){const r=i[0],s=i[1]/100,a=i[2]/100,c=Math.max(a,.01);let l,A;A=(2-s)*a;const u=(2-s)*c;return l=s*c,l/=u<=1?u:2-u,l=l||0,A/=2,[r,l*100,A*100]},n.hwb.rgb=function(i){const r=i[0]/360;let s=i[1]/100,a=i[2]/100;const c=s+a;let l;c>1&&(s/=c,a/=c);const A=Math.floor(6*r),u=1-a;l=6*r-A,(A&1)!==0&&(l=1-l);const d=s+l*(u-s);let _,h,m;switch(A){default:case 6:case 0:_=u,h=d,m=s;break;case 1:_=d,h=u,m=s;break;case 2:_=s,h=u,m=d;break;case 3:_=s,h=d,m=u;break;case 4:_=d,h=s,m=u;break;case 5:_=u,h=s,m=d;break}return[_*255,h*255,m*255]},n.cmyk.rgb=function(i){const r=i[0]/100,s=i[1]/100,a=i[2]/100,c=i[3]/100,l=1-Math.min(1,r*(1-c)+c),A=1-Math.min(1,s*(1-c)+c),u=1-Math.min(1,a*(1-c)+c);return[l*255,A*255,u*255]},n.xyz.rgb=function(i){const r=i[0]/100,s=i[1]/100,a=i[2]/100;let c,l,A;return c=r*3.2406+s*-1.5372+a*-.4986,l=r*-.9689+s*1.8758+a*.0415,A=r*.0557+s*-.204+a*1.057,c=c>.0031308?1.055*c**(1/2.4)-.055:c*12.92,l=l>.0031308?1.055*l**(1/2.4)-.055:l*12.92,A=A>.0031308?1.055*A**(1/2.4)-.055:A*12.92,c=Math.min(Math.max(0,c),1),l=Math.min(Math.max(0,l),1),A=Math.min(Math.max(0,A),1),[c*255,l*255,A*255]},n.xyz.lab=function(i){let r=i[0],s=i[1],a=i[2];r/=95.047,s/=100,a/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,a=a>.008856?a**(1/3):7.787*a+16/116;const c=116*s-16,l=500*(r-s),A=200*(s-a);return[c,l,A]},n.lab.xyz=function(i){const r=i[0],s=i[1],a=i[2];let c,l,A;l=(r+16)/116,c=s/500+l,A=l-a/200;const u=l**3,d=c**3,_=A**3;return l=u>.008856?u:(l-16/116)/7.787,c=d>.008856?d:(c-16/116)/7.787,A=_>.008856?_:(A-16/116)/7.787,c*=95.047,l*=100,A*=108.883,[c,l,A]},n.lab.lch=function(i){const r=i[0],s=i[1],a=i[2];let c;c=Math.atan2(a,s)*360/2/Math.PI,c<0&&(c+=360);const A=Math.sqrt(s*s+a*a);return[r,A,c]},n.lch.lab=function(i){const r=i[0],s=i[1],c=i[2]/360*2*Math.PI,l=s*Math.cos(c),A=s*Math.sin(c);return[r,l,A]},n.rgb.ansi16=function(i,r=null){const[s,a,c]=i;let l=r===null?n.rgb.hsv(i)[2]:r;if(l=Math.round(l/50),l===0)return 30;let A=30+(Math.round(c/255)<<2|Math.round(a/255)<<1|Math.round(s/255));return l===2&&(A+=60),A},n.hsv.ansi16=function(i){return n.rgb.ansi16(n.hsv.rgb(i),i[2])},n.rgb.ansi256=function(i){const r=i[0],s=i[1],a=i[2];return r===s&&s===a?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(s/255*5)+Math.round(a/255*5)},n.ansi16.rgb=function(i){let r=i%10;if(r===0||r===7)return i>50&&(r+=3.5),r=r/10.5*255,[r,r,r];const s=(~~(i>50)+1)*.5,a=(r&1)*s*255,c=(r>>1&1)*s*255,l=(r>>2&1)*s*255;return[a,c,l]},n.ansi256.rgb=function(i){if(i>=232){const l=(i-232)*10+8;return[l,l,l]}i-=16;let r;const s=Math.floor(i/36)/5*255,a=Math.floor((r=i%36)/6)/5*255,c=r%6/5*255;return[s,a,c]},n.rgb.hex=function(i){const s=(((Math.round(i[0])&255)<<16)+((Math.round(i[1])&255)<<8)+(Math.round(i[2])&255)).toString(16).toUpperCase();return"000000".substring(s.length)+s},n.hex.rgb=function(i){const r=i.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!r)return[0,0,0];let s=r[0];r[0].length===3&&(s=s.split("").map(u=>u+u).join(""));const a=parseInt(s,16),c=a>>16&255,l=a>>8&255,A=a&255;return[c,l,A]},n.rgb.hcg=function(i){const r=i[0]/255,s=i[1]/255,a=i[2]/255,c=Math.max(Math.max(r,s),a),l=Math.min(Math.min(r,s),a),A=c-l;let u,d;return A<1?u=l/(1-A):u=0,A<=0?d=0:c===r?d=(s-a)/A%6:c===s?d=2+(a-r)/A:d=4+(r-s)/A,d/=6,d%=1,[d*360,A*100,u*100]},n.hsl.hcg=function(i){const r=i[1]/100,s=i[2]/100,a=s<.5?2*r*s:2*r*(1-s);let c=0;return a<1&&(c=(s-.5*a)/(1-a)),[i[0],a*100,c*100]},n.hsv.hcg=function(i){const r=i[1]/100,s=i[2]/100,a=r*s;let c=0;return a<1&&(c=(s-a)/(1-a)),[i[0],a*100,c*100]},n.hcg.rgb=function(i){const r=i[0]/360,s=i[1]/100,a=i[2]/100;if(s===0)return[a*255,a*255,a*255];const c=[0,0,0],l=r%1*6,A=l%1,u=1-A;let d=0;switch(Math.floor(l)){case 0:c[0]=1,c[1]=A,c[2]=0;break;case 1:c[0]=u,c[1]=1,c[2]=0;break;case 2:c[0]=0,c[1]=1,c[2]=A;break;case 3:c[0]=0,c[1]=u,c[2]=1;break;case 4:c[0]=A,c[1]=0,c[2]=1;break;default:c[0]=1,c[1]=0,c[2]=u}return d=(1-s)*a,[(s*c[0]+d)*255,(s*c[1]+d)*255,(s*c[2]+d)*255]},n.hcg.hsv=function(i){const r=i[1]/100,s=i[2]/100,a=r+s*(1-r);let c=0;return a>0&&(c=r/a),[i[0],c*100,a*100]},n.hcg.hsl=function(i){const r=i[1]/100,a=i[2]/100*(1-r)+.5*r;let c=0;return a>0&&a<.5?c=r/(2*a):a>=.5&&a<1&&(c=r/(2*(1-a))),[i[0],c*100,a*100]},n.hcg.hwb=function(i){const r=i[1]/100,s=i[2]/100,a=r+s*(1-r);return[i[0],(a-r)*100,(1-a)*100]},n.hwb.hcg=function(i){const r=i[1]/100,a=1-i[2]/100,c=a-r;let l=0;return c<1&&(l=(a-c)/(1-c)),[i[0],c*100,l*100]},n.apple.rgb=function(i){return[i[0]/65535*255,i[1]/65535*255,i[2]/65535*255]},n.rgb.apple=function(i){return[i[0]/255*65535,i[1]/255*65535,i[2]/255*65535]},n.gray.rgb=function(i){return[i[0]/100*255,i[0]/100*255,i[0]/100*255]},n.gray.hsl=function(i){return[0,0,i[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(i){return[0,100,i[0]]},n.gray.cmyk=function(i){return[0,0,0,i[0]]},n.gray.lab=function(i){return[i[0],0,0]},n.gray.hex=function(i){const r=Math.round(i[0]/100*255)&255,a=((r<<16)+(r<<8)+r).toString(16).toUpperCase();return"000000".substring(a.length)+a},n.rgb.gray=function(i){return[(i[0]+i[1]+i[2])/3/255*100]},EPe}var bPe,mbt;function nyo(){if(mbt)return bPe;mbt=1;const t=_bt();function e(){const r={},s=Object.keys(t);for(let a=s.length,c=0;c<a;c++)r[s[c]]={distance:-1,parent:null};return r}function n(r){const s=e(),a=[r];for(s[r].distance=0;a.length;){const c=a.pop(),l=Object.keys(t[c]);for(let A=l.length,u=0;u<A;u++){const d=l[u],_=s[d];_.distance===-1&&(_.distance=s[c].distance+1,_.parent=c,a.unshift(d))}}return s}function o(r,s){return function(a){return s(r(a))}}function i(r,s){const a=[s[r].parent,r];let c=t[s[r].parent][r],l=s[r].parent;for(;s[l].parent;)a.unshift(s[l].parent),c=o(t[s[l].parent][l],c),l=s[l].parent;return c.conversion=a,c}return bPe=function(r){const s=n(r),a={},c=Object.keys(s);for(let l=c.length,A=0;A<l;A++){const u=c[A];s[u].parent!==null&&(a[u]=i(u,s))}return a},bPe}var SPe,gbt;function oyo(){if(gbt)return SPe;gbt=1;const t=_bt(),e=nyo(),n={},o=Object.keys(t);function i(s){const a=function(...c){const l=c[0];return l==null?l:(l.length>1&&(c=l),s(c))};return"conversion"in s&&(a.conversion=s.conversion),a}function r(s){const a=function(...c){const l=c[0];if(l==null)return l;l.length>1&&(c=l);const A=s(c);if(typeof A=="object")for(let u=A.length,d=0;d<u;d++)A[d]=Math.round(A[d]);return A};return"conversion"in s&&(a.conversion=s.conversion),a}return o.forEach(s=>{n[s]={},Object.defineProperty(n[s],"channels",{value:t[s].channels}),Object.defineProperty(n[s],"labels",{value:t[s].labels});const a=e(s);Object.keys(a).forEach(l=>{const A=a[l];n[s][l]=r(A),n[s][l].raw=i(A)})}),SPe=n,SPe}var PPe,pbt;function iyo(){if(pbt)return PPe;pbt=1;const t=tyo(),e=oyo(),n=["keyword","gray","hex"],o={};for(const d of Object.keys(e))o[[...e[d].labels].sort().join("")]=d;const i={};function r(d,_){if(!(this instanceof r))return new r(d,_);if(_&&_ in n&&(_=null),_&&!(_ in e))throw new Error("Unknown model: "+_);let h,m;if(d==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(d instanceof r)this.model=d.model,this.color=[...d.color],this.valpha=d.valpha;else if(typeof d=="string"){const p=t.get(d);if(p===null)throw new Error("Unable to parse color from string: "+d);this.model=p.model,m=e[this.model].channels,this.color=p.value.slice(0,m),this.valpha=typeof p.value[m]=="number"?p.value[m]:1}else if(d.length>0){this.model=_||"rgb",m=e[this.model].channels;const p=Array.prototype.slice.call(d,0,m);this.color=u(p,m),this.valpha=typeof d[m]=="number"?d[m]:1}else if(typeof d=="number")this.model="rgb",this.color=[d>>16&255,d>>8&255,d&255],this.valpha=1;else{this.valpha=1;const p=Object.keys(d);"alpha"in d&&(p.splice(p.indexOf("alpha"),1),this.valpha=typeof d.alpha=="number"?d.alpha:0);const g=p.sort().join("");if(!(g in o))throw new Error("Unable to parse color from object: "+JSON.stringify(d));this.model=o[g];const{labels:f}=e[this.model],y=[];for(h=0;h<f.length;h++)y.push(d[f[h]]);this.color=u(y)}if(i[this.model])for(m=e[this.model].channels,h=0;h<m;h++){const p=i[this.model][h];p&&(this.color[h]=p(this.color[h]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}r.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(d){let _=this.model in t.to?this:this.rgb();_=_.round(typeof d=="number"?d:1);const h=_.valpha===1?_.color:[..._.color,this.valpha];return t.to[_.model](h)},percentString(d){const _=this.rgb().round(typeof d=="number"?d:1),h=_.valpha===1?_.color:[..._.color,this.valpha];return t.to.rgb.percent(h)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const d={},{channels:_}=e[this.model],{labels:h}=e[this.model];for(let m=0;m<_;m++)d[h[m]]=this.color[m];return this.valpha!==1&&(d.alpha=this.valpha),d},unitArray(){const d=this.rgb().color;return d[0]/=255,d[1]/=255,d[2]/=255,this.valpha!==1&&d.push(this.valpha),d},unitObject(){const d=this.rgb().object();return d.r/=255,d.g/=255,d.b/=255,this.valpha!==1&&(d.alpha=this.valpha),d},round(d){return d=Math.max(d||0,0),new r([...this.color.map(a(d)),this.valpha],this.model)},alpha(d){return d!==void 0?new r([...this.color,Math.max(0,Math.min(1,d))],this.model):this.valpha},red:c("rgb",0,l(255)),green:c("rgb",1,l(255)),blue:c("rgb",2,l(255)),hue:c(["hsl","hsv","hsl","hwb","hcg"],0,d=>(d%360+360)%360),saturationl:c("hsl",1,l(100)),lightness:c("hsl",2,l(100)),saturationv:c("hsv",1,l(100)),value:c("hsv",2,l(100)),chroma:c("hcg",1,l(100)),gray:c("hcg",2,l(100)),white:c("hwb",1,l(100)),wblack:c("hwb",2,l(100)),cyan:c("cmyk",0,l(100)),magenta:c("cmyk",1,l(100)),yellow:c("cmyk",2,l(100)),black:c("cmyk",3,l(100)),x:c("xyz",0,l(95.047)),y:c("xyz",1,l(100)),z:c("xyz",2,l(108.833)),l:c("lab",0,l(100)),a:c("lab",1),b:c("lab",2),keyword(d){return d!==void 0?new r(d):e[this.model].keyword(this.color)},hex(d){return d!==void 0?new r(d):t.to.hex(this.rgb().round().color)},hexa(d){if(d!==void 0)return new r(d);const _=this.rgb().round().color;let h=Math.round(this.valpha*255).toString(16).toUpperCase();return h.length===1&&(h="0"+h),t.to.hex(_)+h},rgbNumber(){const d=this.rgb().color;return(d[0]&255)<<16|(d[1]&255)<<8|d[2]&255},luminosity(){const d=this.rgb().color,_=[];for(const[h,m]of d.entries()){const p=m/255;_[h]=p<=.04045?p/12.92:((p+.055)/1.055)**2.4}return .2126*_[0]+.7152*_[1]+.0722*_[2]},contrast(d){const _=this.luminosity(),h=d.luminosity();return _>h?(_+.05)/(h+.05):(h+.05)/(_+.05)},level(d){const _=this.contrast(d);return _>=7?"AAA":_>=4.5?"AA":""},isDark(){const d=this.rgb().color;return(d[0]*2126+d[1]*7152+d[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const d=this.rgb();for(let _=0;_<3;_++)d.color[_]=255-d.color[_];return d},lighten(d){const _=this.hsl();return _.color[2]+=_.color[2]*d,_},darken(d){const _=this.hsl();return _.color[2]-=_.color[2]*d,_},saturate(d){const _=this.hsl();return _.color[1]+=_.color[1]*d,_},desaturate(d){const _=this.hsl();return _.color[1]-=_.color[1]*d,_},whiten(d){const _=this.hwb();return _.color[1]+=_.color[1]*d,_},blacken(d){const _=this.hwb();return _.color[2]+=_.color[2]*d,_},grayscale(){const d=this.rgb().color,_=d[0]*.3+d[1]*.59+d[2]*.11;return r.rgb(_,_,_)},fade(d){return this.alpha(this.valpha-this.valpha*d)},opaquer(d){return this.alpha(this.valpha+this.valpha*d)},rotate(d){const _=this.hsl();let h=_.color[0];return h=(h+d)%360,h=h<0?360+h:h,_.color[0]=h,_},mix(d,_){if(!d||!d.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof d);const h=d.rgb(),m=this.rgb(),p=_===void 0?.5:_,g=2*p-1,f=h.alpha()-m.alpha(),y=((g*f===-1?g:(g+f)/(1+g*f))+1)/2,C=1-y;return r.rgb(y*h.red()+C*m.red(),y*h.green()+C*m.green(),y*h.blue()+C*m.blue(),h.alpha()*p+m.alpha()*(1-p))}};for(const d of Object.keys(e)){if(n.includes(d))continue;const{channels:_}=e[d];r.prototype[d]=function(...h){return this.model===d?new r(this):h.length>0?new r(h,d):new r([...A(e[this.model][d].raw(this.color)),this.valpha],d)},r[d]=function(...h){let m=h[0];return typeof m=="number"&&(m=u(h,_)),new r(m,d)}}function s(d,_){return Number(d.toFixed(_))}function a(d){return function(_){return s(_,d)}}function c(d,_,h){d=Array.isArray(d)?d:[d];for(const m of d)(i[m]||(i[m]=[]))[_]=h;return d=d[0],function(m){let p;return m!==void 0?(h&&(m=h(m)),p=this[d](),p.color[_]=m,p):(p=this[d]().color[_],h&&(p=h(p)),p)}}function l(d){return function(_){return Math.max(0,Math.min(d,_))}}function A(d){return Array.isArray(d)?d:[d]}function u(d,_){for(let h=0;h<_;h++)typeof d[h]!="number"&&(d[h]=0);return d}return PPe=r,PPe}var ryo=iyo();const ml=f2(ryo);function So(t,e){return Array.isArray(e)?[t.a*e[0]+t.c*e[1]+t.e,t.b*e[0]+t.d*e[1]+t.f]:{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function syo(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function dO(t){return typeof t>"u"}function av(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function Nee(...t){t=Array.isArray(t[0])?t[0]:t;const e=(n,o)=>({a:n.a*o.a+n.c*o.b,c:n.a*o.c+n.c*o.d,e:n.a*o.e+n.c*o.f+n.e,b:n.b*o.a+n.d*o.b,d:n.b*o.c+n.d*o.d,f:n.b*o.e+n.d*o.f+n.f});switch(t.length){case 0:throw new Error("no matrices provided");case 1:return t[0];case 2:return e(t[0],t[1]);default:{const[n,o,...i]=t,r=e(n,o);return Nee(r,...i)}}}function vPe(...t){return Nee(...t)}const{cos:ayo,sin:cyo}=Math;function fbt(t,e,n){const o=ayo(t),i=cyo(t),r={a:o,c:-i,e:0,b:i,d:o,f:0};return dO(e)||dO(n)?r:Nee([av(e,n),r,av(-e,-n)])}function lyo(t,e=void 0,n=void 0,o=void 0){dO(e)&&(e=t);const i={a:t,c:0,e:0,b:0,d:e,f:0};return dO(n)||dO(o)?i:Nee([av(n,o),i,av(-n,-o)])}function kee(t){const{ctx:e,points:n,fill:o,stroke:i,strokeWidth:r=1,minStrokePx:s,realToCanvasMat:a,closePath:c=!1}=t;if(n.length<2)return;e.beginPath();const l=n.map(_=>So(a,[_.x,_.y])),A=l[0];if(!A)return;const[u,d]=A;e.moveTo(u,d);for(let _=1;_<l.length;_++){const h=l[_];if(!h)continue;const[m,p]=h;e.lineTo(m,p)}if(c&&e.closePath(),o&&(e.fillStyle=o,e.fill()),i){const _=r*Math.abs(a.a),h=s===void 0?_:Math.max(_,s);e.strokeStyle=i,e.lineWidth=h,e.stroke()}}function U_(t){const{ctx:e,center:n,width:o,height:i,fill:r,realToCanvasMat:s,borderRadius:a=0,ccwRotationDegrees:c=0,stroke:l,strokeWidth:A,isStrokeDashed:u=!1,lineJoin:d}=t,[_,h]=So(s,[n.x,n.y]),m=o*Math.abs(s.a),p=i*Math.abs(s.a),g=a*Math.abs(s.a),f=A?A*Math.abs(s.a):void 0;if(e.save(),e.translate(_,h),c!==0&&e.rotate(-c*(Math.PI/180)),e.beginPath(),g>0){const y=-m/2,C=-p/2,I=Math.min(g,m/2,p/2);e.moveTo(y+I,C),e.lineTo(y+m-I,C),e.arcTo(y+m,C,y+m,C+I,I),e.lineTo(y+m,C+p-I),e.arcTo(y+m,C+p,y+m-I,C+p,I),e.lineTo(y+I,C+p),e.arcTo(y,C+p,y,C+p-I,I),e.lineTo(y,C+I),e.arcTo(y,C,y+I,C,I)}else e.rect(-m/2,-p/2,m,p);r&&(e.fillStyle=r,e.fill()),l&&f&&(u?e.setLineDash([f*3,f*2]):e.setLineDash([]),d&&(e.lineJoin=d),e.strokeStyle=l,e.lineWidth=f,e.stroke()),e.restore()}function Ayo(t){const{ctx:e,board:n,realToCanvasMat:o,colorMap:i,drawBoardMaterial:r,minBoardOutlineStrokePx:s}=t,{width:a,height:c,center:l,outline:A}=n;if(A&&Array.isArray(A)&&A.length>=3){r&&kee({ctx:e,points:A.map(u=>({x:u.x,y:u.y})),fill:i.substrate,realToCanvasMat:o,closePath:!0}),kee({ctx:e,points:A.map(u=>({x:u.x,y:u.y})),stroke:i.boardOutline,strokeWidth:.1,realToCanvasMat:o,closePath:!0,minStrokePx:s});return}if(a!==void 0&&c!==void 0&&l){r&&U_({ctx:e,center:l,width:a,height:c,fill:i.substrate,realToCanvasMat:o});const u=a/2,d=c/2,_=[{x:l.x-u,y:l.y-d},{x:l.x+u,y:l.y-d},{x:l.x+u,y:l.y+d},{x:l.x-u,y:l.y+d}];kee({ctx:e,points:_,stroke:i.boardOutline,strokeWidth:.1,realToCanvasMat:o,closePath:!0,minStrokePx:s})}}function cv(t){const{ctx:e,points:n,fill:o,realToCanvasMat:i}=t;if(n.length<3)return;e.beginPath();const r=n.map(l=>So(i,[l.x,l.y])),s=r[0];if(!s)return;const[a,c]=s;e.moveTo(a,c);for(let l=1;l<r.length;l++){const A=r[l];if(!A)continue;const[u,d]=A;e.lineTo(u,d)}e.closePath(),e.fillStyle=o,e.fill()}function uyo(t,e){return e.copper[t]??e.copper.top}function dyo(t,e,n,o,i){if(Math.abs(i)<1e-10)return null;const r=n-t,s=o-e,a=Math.hypot(r,s);if(a<1e-10)return null;const c=Math.abs(i)*(a/2),l=a/2,A=(c*c+l*l)/(2*c),u=A-c,d=(t+n)/2,_=(e+o)/2,h=-s/a,m=r/a,p=i>0?-1:1,g=d+p*h*u,f=_+p*m*u;return{centerX:g,centerY:f,radius:A}}function BPe(t,e,n,o,i,r,s){if(Math.abs(r)<1e-10){const[C,I]=So(s,[o,i]);t.lineTo(C,I);return}const a=dyo(e,n,o,i,r);if(!a){const[C,I]=So(s,[o,i]);t.lineTo(C,I);return}const[c,l]=So(s,[e,n]),[A,u]=So(s,[o,i]),[d,_]=So(s,[a.centerX,a.centerY]),h=Math.hypot(c-d,l-_),m=Math.atan2(l-_,c-d),p=Math.atan2(u-_,A-d),f=s.a*s.d-s.b*s.c<0,y=r>0?!f:f;t.arc(d,_,h,m,p,y)}function ybt(t,e,n){if(e.vertices.length<2)return;if(e.vertices.length===2){const s=e.vertices[0],a=e.vertices[1];if(s&&a&&Math.abs((s.bulge??0)-1)<1e-10&&Math.abs((a.bulge??0)-1)<1e-10){const[c,l]=So(n,[s.x,s.y]);t.moveTo(c,l),BPe(t,s.x,s.y,a.x,a.y,1,n),BPe(t,a.x,a.y,s.x,s.y,1,n);return}}const o=e.vertices[0];if(!o)return;const[i,r]=So(n,[o.x,o.y]);t.moveTo(i,r);for(let s=0;s<e.vertices.length;s++){const a=e.vertices[s],c=(s+1)%e.vertices.length,l=e.vertices[c];if(!a||!l)continue;const A=a.bulge??0;if(Math.abs(A)<1e-10){const[u,d]=So(n,[l.x,l.y]);t.lineTo(u,d)}else BPe(t,a.x,a.y,l.x,l.y,A,n)}}function hyo(t){const{ctx:e,pour:n,realToCanvasMat:o,colorMap:i}=t,r=uyo(n.layer,i),s=.5;if(e.save(),e.globalAlpha=s,n.shape==="rect"){const[a,c]=So(o,[n.center.x,n.center.y]),l=n.width*Math.abs(o.a),A=n.height*Math.abs(o.a);e.translate(a,c),n.rotation&&e.rotate(-n.rotation*(Math.PI/180)),e.beginPath(),e.rect(-l/2,-A/2,l,A),e.fillStyle=r,e.fill(),e.restore();return}if(n.shape==="polygon"){if(n.points&&n.points.length>=3){const a=n.points.map(u=>So(o,[u.x,u.y])),c=a[0];if(!c){e.restore();return}e.beginPath();const[l,A]=c;e.moveTo(l,A);for(let u=1;u<a.length;u++){const d=a[u];if(!d)continue;const[_,h]=d;e.lineTo(_,h)}e.closePath(),e.fillStyle=r,e.fill()}e.restore();return}if(n.shape==="brep"){if(e.beginPath(),ybt(e,n.brep_shape.outer_ring,o),n.brep_shape.inner_rings)for(const a of n.brep_shape.inner_rings)ybt(e,a,o);e.fillStyle=r,e.fill("evenodd"),e.restore();return}e.restore()}function _yo(t,e){if(e.length<3)return;const n=e[0];if(n){t.moveTo(n.x,n.y);for(let o=1;o<e.length;o++){const i=e[o];i&&t.lineTo(i.x,i.y)}t.closePath()}}var myo=t=>Kgt[t]??(t===" "?Bf.spaceWidthRatio:Bf.glyphWidthRatio);function MPe(t,e,n){const o=myo(t),i=e?Bf.letterSpacingRatio:0,r=e?Wgt[t]?.[e]??0:0;return n*(o+i+r)}function gyo(t,e){const n=e*Bf.glyphWidthRatio,o=e*Bf.letterSpacingRatio,i=e*Bf.spaceWidthRatio,r=e*Bf.strokeWidthRatio,s=e*Bf.lineHeightRatio,a=t.replace(/\\n/g,`
|
|
5625
5625
|
`).split(`
|
|
5626
5626
|
`),c=a.map(u=>{const d=Array.from(u);return d.reduce((_,h,m)=>_+MPe(h,d[m+1],e),0)}),l=c.reduce((u,d)=>Math.max(u,d),0),A=a.length>1?e+(a.length-1)*s:e;return{width:l,height:A,glyphWidth:n,letterSpacing:o,spaceWidth:i,strokeWidth:r,lineHeight:s,lines:a,lineWidths:c}}function pyo(t){const{line:e,fontSize:n,startX:o,startY:i}=t,r=n,s=n,a=Array.from(e),c=[];let l=o+t.layout.strokeWidth/2;return a.forEach((A,u)=>{const d=jgt[A];if(d?.length){const _=[];for(const h of d){const m=h.map(p=>({x:l+p.x*s,y:i+(1-p.y)*r}));m.length>=3&&_.push(m)}_.length>0&&c.push(_)}l+=MPe(A,a[u+1],n)}),c}function fyo(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const r of t)for(const s of r)e=Math.min(e,s.x),n=Math.min(n,s.y),o=Math.max(o,s.x),i=Math.max(i,s.y);return e===Number.POSITIVE_INFINITY||n===Number.POSITIVE_INFINITY||o===Number.NEGATIVE_INFINITY||i===Number.NEGATIVE_INFINITY?null:{minX:e,minY:n,maxX:o,maxY:i}}function yyo(t,e){const n=e.width+e.strokeWidth,o=e.height+e.strokeWidth;let i=0,r=0;return t==="center"||t==="top_center"||t==="bottom_center"?i=-n/2:t==="top_left"||t==="bottom_left"||t==="center_left"?i=0:t==="top_right"||t==="bottom_right"||t==="center_right"?i=-n:(t==="top_center"||t==="bottom_center")&&(i=-n/2),t==="center"||t==="center_left"||t==="center_right"?r=-o/2:t==="top_left"||t==="top_right"||t==="top_center"?r=0:(t==="bottom_left"||t==="bottom_right"||t==="bottom_center")&&(r=-o),{x:i,y:r}}function Cbt(t){const{alignment:e,lineWidth:n,maxWidth:o,strokeWidth:i}=t,r=n+i,s=o+i;return e==="top_left"||e==="bottom_left"||e==="center_left"?0:e==="top_right"||e==="bottom_right"||e==="center_right"?s-r:(s-r)/2}var Cyo=t=>Ygt[t];function xyo(t){const{ctx:e,line:n,fontSize:o,startX:i,startY:r,layout:s}=t,{strokeWidth:a}=s,c=o,l=o,A=r,u=Array.from(n);let d=i+a/2;u.forEach((_,h)=>{const m=Cyo(_);if(m?.length){e.beginPath();for(const p of m){const g=d+p.x1*l,f=A+(1-p.y1)*c,y=d+p.x2*l,C=A+(1-p.y2)*c;e.moveTo(g,f),e.lineTo(y,C)}e.stroke()}d+=MPe(_,u[h+1],o)})}var Iyo={left:.2,right:.2,top:.2,bottom:.2};function hO(t){const{ctx:e,text:n,x:o,y:i,fontSize:r,color:s,realToCanvasMat:a,anchorAlignment:c,rotation:l=0,mirrorX:A=!1,knockout:u=!1,knockoutPadding:d={}}=t;if(!n)return;const[_,h]=So(a,[o,i]),m=Math.abs(a.a),p=r*m,g=gyo(n,p),f=yyo(c,g),{lines:y,lineWidths:C,lineHeight:I,width:E,strokeWidth:b}=g;if(e.save(),e.translate(_,h),l!==0&&e.rotate(-l*(Math.PI/180)),A&&e.scale(-1,1),u){const P={...Iyo,...d},B=P.left*m,M=P.right*m,k=P.top*m,N=P.bottom*m,L=[],F=[];for(const[le,ee]of y.entries()){const ie=f.x+Cbt({alignment:c,lineWidth:C[le],maxWidth:E,strokeWidth:b}),ae=f.y+le*I,re=pyo({line:ee,fontSize:p,startX:ie,startY:ae,layout:g});F.push(...re);for(const ue of re)L.push(...ue)}const G=fyo(L);if(!G){e.restore();return}const W=G.minX-B,j=G.minY-k,$=G.maxX-G.minX+B+M,oe=G.maxY-G.minY+k+N;e.fillStyle=s,e.beginPath(),e.rect(W,j,$,oe);for(const le of F)for(const ee of le)_yo(e,ee);e.fill("evenodd")}else e.strokeStyle=s;e.lineWidth=g.strokeWidth,e.lineCap="round",e.lineJoin="round",u||y.forEach((P,B)=>{const M=f.x+Cbt({alignment:c,lineWidth:C[B],maxWidth:E,strokeWidth:b}),k=f.y+B*I;xyo({ctx:e,line:P,fontSize:p,startX:M,startY:k,layout:g})}),e.restore()}function Eyo(t){return t?t.includes("left")?"center_left":t.includes("right")?"center_right":"center":"center"}function byo(t){const{ctx:e,text:n,realToCanvasMat:o,colorMap:i}=t,r=n.text??"";r&&hO({ctx:e,text:r,x:n.anchor_position.x,y:n.anchor_position.y,fontSize:n.font_size??1,color:i.copper[n.layer]??i.copper.top,realToCanvasMat:o,anchorAlignment:Eyo(n.anchor_alignment),rotation:n.ccw_rotation??0,mirrorX:n.is_mirrored??n.layer==="bottom",knockout:n.is_knockout,knockoutPadding:n.is_knockout?n.knockout_padding:void 0})}function z_(t){const{ctx:e,center:n,radius:o,fill:i,realToCanvasMat:r,stroke:s,strokeWidth:a,isStrokeDashed:c=!1}=t,[l,A]=So(r,[n.x,n.y]),u=o*Math.abs(r.a),d=a?a*Math.abs(r.a):void 0;e.beginPath(),e.arc(l,A,u,0,Math.PI*2),i&&(e.fillStyle=i,e.fill()),s&&d&&(c?e.setLineDash([d*3,d*2]):e.setLineDash([]),e.strokeStyle=s,e.lineWidth=d,e.stroke())}function Syo(t,e){return t==="bottom"?e.courtyard.bottom:e.courtyard.top}function Pyo(t){const{ctx:e,circle:n,realToCanvasMat:o,colorMap:i}=t;z_({ctx:e,center:n.center,radius:n.radius,stroke:Syo(n.layer,i),strokeWidth:.05,realToCanvasMat:o})}function vyo(t,e){return t==="bottom"?e.courtyard.bottom:e.courtyard.top}function Byo(t){const{ctx:e,outline:n,realToCanvasMat:o,colorMap:i}=t;if(!n.outline||n.outline.length<2)return;e.beginPath();const r=So(o,n.outline[0]);e.moveTo(r.x,r.y);for(let s=1;s<n.outline.length;s++){const a=So(o,n.outline[s]);e.lineTo(a.x,a.y)}e.closePath(),e.lineWidth=.05*Math.abs(o.a),e.strokeStyle=vyo(n.layer,i),e.lineJoin="round",e.stroke()}function Myo(t,e){return t==="bottom"?e.courtyard.bottom:e.courtyard.top}function wyo(t){const{ctx:e,rect:n,realToCanvasMat:o,colorMap:i}=t;U_({ctx:e,center:n.center,width:n.width,height:n.height,stroke:Myo(n.layer,i),strokeWidth:.05,realToCanvasMat:o,ccwRotationDegrees:n.ccw_rotation??0,lineJoin:"round"})}function Dyo(t){const{ctx:e,cutout:n,realToCanvasMat:o,colorMap:i}=t;if(n.shape==="rect"){U_({ctx:e,center:n.center,width:n.width,height:n.height,fill:i.drill,realToCanvasMat:o,ccwRotationDegrees:n.rotation??0,borderRadius:n.corner_radius??0});return}if(n.shape==="circle"){z_({ctx:e,center:n.center,radius:n.radius,fill:i.drill,realToCanvasMat:o});return}if(n.shape==="polygon"){n.points&&n.points.length>=3&&cv({ctx:e,points:n.points,fill:i.drill,realToCanvasMat:o});return}}var Qyo=1.5,Tyo=.6,Ryo=.3;function wPe(t){const e=Math.hypot(t.x,t.y)||1;return{x:t.x/e,y:t.y/e}}function xbt(t){const{ctx:e,from:n,to:o,realToCanvasMat:i,color:r,fontSize:s,arrowSize:a=1,strokeWidth:c,text:l,textRotation:A,offset:u}=t,d=wPe({x:o.x-n.x,y:o.y-n.y}),_={x:-d.y,y:d.x},h=u?.direction&&typeof u.direction.x=="number"&&typeof u.direction.y=="number",m=h?wPe(u.direction):{x:0,y:0},p=u?.distance??0,g={x:m.x*p,y:m.y*p},f={x:n.x+g.x,y:n.y+g.y},y={x:o.x+g.x,y:o.y+g.y},C={x:f.x+d.x*a,y:f.y+d.y*a},I={x:y.x-d.x*a,y:y.y-d.y*a};Math.abs(i.a);const E=c??a/5,b=r||"rgba(255,255,255,0.5)",P=h&&(Math.abs(m.x)>Number.EPSILON||Math.abs(m.y)>Number.EPSILON)?m:_,B=p+.5,M=[],k=F=>{const G={x:F.x+P.x*B,y:F.y+P.y*B},W=E/2,j={x:-P.y,y:P.x};return[{x:F.x+j.x*W,y:F.y+j.y*W},{x:F.x-j.x*W,y:F.y-j.y*W},{x:G.x-j.x*W,y:G.y-j.y*W},{x:G.x+j.x*W,y:G.y+j.y*W}]};M.push(f),M.push({x:C.x+_.x*(a/2),y:C.y+_.y*(a/2)}),M.push({x:C.x+_.x*(E/2),y:C.y+_.y*(E/2)}),M.push({x:I.x+_.x*(E/2),y:I.y+_.y*(E/2)}),M.push({x:I.x+_.x*(a/2),y:I.y+_.y*(a/2)}),M.push(y),M.push({x:I.x-_.x*(a/2),y:I.y-_.y*(a/2)}),M.push({x:I.x-_.x*(E/2),y:I.y-_.y*(E/2)}),M.push({x:C.x-_.x*(E/2),y:C.y-_.y*(E/2)}),M.push({x:C.x-_.x*(a/2),y:C.y-_.y*(a/2)}),M.push(f);const N=M[0],L=F=>{const G=k(F);M.push(N),M.push(G[0]),M.push(...G),M.push(G[0]),M.push(N)};if(L(n),L(o),cv({ctx:e,points:M,fill:b,realToCanvasMat:i}),l){const F={x:(n.x+o.x)/2+g.x,y:(n.y+o.y)/2+g.y},[G,W]=So(i,[f.x,f.y]),[j,$]=So(i,[y.x,y.y]),oe=wPe({x:j-G,y:$-W});let le=Math.atan2(oe.y,oe.x)*180/Math.PI;(le>90||le<-90)&&(le+=180);const ee=typeof A=="number"&&Number.isFinite(A)?le-A:le;let ie=0;if(l&&typeof A=="number"&&Number.isFinite(A)){const ue=l.length*s*Tyo,ye=s,be=A*Math.PI/180,ve=Math.abs(Math.sin(be)),he=Math.abs(Math.cos(be)),Pe=ue/2,de=ye/2;ie=Pe*ve+de*he+s*Ryo}const ae=a*Qyo+ie,re={x:F.x+_.x*ae,y:F.y+_.y*ae};hO({ctx:e,text:l,x:re.x,y:re.y,fontSize:s,color:b,realToCanvasMat:i,anchorAlignment:"center",rotation:-ee})}}function Nyo(t){const{ctx:e,pcbFabricationNoteDimension:n,realToCanvasMat:o,colorMap:i}=t,r=n.color??i.fabricationNote;xbt({ctx:e,from:n.from,to:n.to,realToCanvasMat:o,color:r,fontSize:n.font_size??1,arrowSize:n.arrow_size??1,text:n.text,textRotation:n.text_ccw_rotation,offset:n.offset_distance&&n.offset_direction?{distance:n.offset_distance,direction:n.offset_direction}:void 0})}function VQ(t){const{ctx:e,start:n,end:o,strokeWidth:i,stroke:r,realToCanvasMat:s,lineCap:a="round"}=t,[c,l]=So(s,[n.x,n.y]),[A,u]=So(s,[o.x,o.y]),d=i*Math.abs(s.a);e.beginPath(),e.moveTo(c,l),e.lineTo(A,u),e.lineWidth=d,e.strokeStyle=r,e.lineCap=a,e.stroke()}function kyo(t){const{ctx:e,path:n,realToCanvasMat:o,colorMap:i}=t,r=i.fabricationNote,s=n.color??r;if(!(!n.route||n.route.length<2))for(let a=0;a<n.route.length-1;a++){const c=n.route[a],l=n.route[a+1];!c||!l||VQ({ctx:e,start:{x:c.x,y:c.y},end:{x:l.x,y:l.y},strokeWidth:n.stroke_width??.1,stroke:s,realToCanvasMat:o})}}function Hyo(t){const{ctx:e,rect:n,realToCanvasMat:o,colorMap:i}=t,r=i.fabricationNote,s=n.color??r,a=n.is_filled??!1,c=n.has_stroke??!0,l=n.is_stroke_dashed??!1;U_({ctx:e,center:n.center,width:n.width,height:n.height,fill:a?s:void 0,stroke:c?s:void 0,strokeWidth:c?n.stroke_width:void 0,borderRadius:n.corner_radius,realToCanvasMat:o,isStrokeDashed:l})}function Lyo(t,e){return e.fabricationNote}function Fyo(t){const{ctx:e,text:n,realToCanvasMat:o,colorMap:i}=t,r=Lyo(n.layer,i),s=n.color??r,a=n.font_size;hO({ctx:e,text:n.text,x:n.anchor_position.x,y:n.anchor_position.y,fontSize:a,color:s,realToCanvasMat:o,anchorAlignment:n.anchor_alignment})}function iE(t){const{ctx:e,center:n,radius_x:o,radius_y:i,fill:r,stroke:s,strokeWidth:a=.1,realToCanvasMat:c,rotation:l=0}=t,[A,u]=So(c,[n.x,n.y]),d=o*Math.abs(c.a),_=i*Math.abs(c.a),h=a*Math.abs(c.a);e.save(),e.translate(A,u),l!==0&&e.rotate(-l*(Math.PI/180)),e.beginPath(),e.ellipse(0,0,d,_,0,0,Math.PI*2),r&&(e.fillStyle=r,e.fill()),s&&(e.strokeStyle=s,e.lineWidth=h,e.stroke()),e.restore()}function Tm(t){const{ctx:e,center:n,width:o,height:i,fill:r,realToCanvasMat:s,rotation:a=0,stroke:c,strokeWidth:l}=t,[A,u]=So(s,[n.x,n.y]),d=o*Math.abs(s.a),_=i*Math.abs(s.a),h=l?l*Math.abs(s.a):void 0;if(e.save(),e.translate(A,u),a!==0&&e.rotate(-a*(Math.PI/180)),e.beginPath(),d>_){const m=_/2,p=d-_;e.moveTo(-p/2,-m),e.lineTo(p/2,-m),e.arc(p/2,0,m,-Math.PI/2,Math.PI/2),e.lineTo(-p/2,m),e.arc(-p/2,0,m,Math.PI/2,-Math.PI/2)}else if(_>d){const m=d/2,p=_-d;e.moveTo(m,-p/2),e.lineTo(m,p/2),e.arc(0,p/2,m,0,Math.PI),e.lineTo(-m,-p/2),e.arc(0,-p/2,m,Math.PI,0)}else e.arc(0,0,d/2,0,Math.PI*2);e.closePath(),r&&(e.fillStyle=r,e.fill()),c&&h&&(e.strokeStyle=c,e.lineWidth=h,e.stroke()),e.restore()}function Hee(t){return"ccw_rotation"in t&&typeof t.ccw_rotation=="number"?t.ccw_rotation:0}function Ibt(t){const{ctx:e,hole:n,realToCanvasMat:o,colorMap:i,soldermaskMargin:r=0,drawSoldermask:s=!1}=t;if(s&&n.is_covered_with_solder_mask===!0)return;const a=r<0?Math.abs(r):0;if(n.hole_shape==="circle"){z_({ctx:e,center:{x:n.x,y:n.y},radius:n.hole_diameter/2-a,fill:i.drill,realToCanvasMat:o});return}if(n.hole_shape==="square"){const c=Hee(n);U_({ctx:e,center:{x:n.x,y:n.y},width:n.hole_diameter-a*2,height:n.hole_diameter-a*2,fill:i.drill,realToCanvasMat:o,ccwRotationDegrees:c});return}if(n.hole_shape==="oval"){const c=Hee(n);iE({ctx:e,center:{x:n.x,y:n.y},radius_x:n.hole_width/2-a,radius_y:n.hole_height/2-a,fill:i.drill,realToCanvasMat:o,rotation:c});return}if(n.hole_shape==="rect"){const c=Hee(n);U_({ctx:e,center:{x:n.x,y:n.y},width:n.hole_width-a*2,height:n.hole_height-a*2,fill:i.drill,realToCanvasMat:o,ccwRotationDegrees:c});return}if(n.hole_shape==="pill"||n.hole_shape==="rotated_pill"){const c=Hee(n);Tm({ctx:e,center:{x:n.x,y:n.y},width:n.hole_width-a*2,height:n.hole_height-a*2,fill:i.drill,realToCanvasMat:o,rotation:c});return}}function Oyo(t,e){const n=parseInt(t.slice(1,3),16),o=parseInt(t.slice(3,5),16),i=parseInt(t.slice(5,7),16);return`rgba(${n}, ${o}, ${i}, ${e})`}function Gyo(t){const{ctx:e,keepout:n,realToCanvasMat:o,colorMap:i}=t,r=i.keepout,s=Oyo(i.keepout,.2),a=1;if(n.shape==="rect"){const[c,l]=So(o,[n.center.x,n.center.y]),A=n.width*Math.abs(o.a),u=n.height*Math.abs(o.a),d=n.rotation??0;e.save(),e.translate(c,l),d!==0&&e.rotate(-d*(Math.PI/180)),e.beginPath(),e.rect(-A/2,-u/2,A,u),e.fillStyle=s,e.fill(),e.beginPath(),e.rect(-A/2,-u/2,A,u),e.clip();const _=a*Math.abs(o.a),h=Math.sqrt(A*A+u*u),m=A/2,p=u/2;e.strokeStyle=r,e.lineWidth=.15*Math.abs(o.a),e.setLineDash([]);for(let g=-h;g<h*2;g+=_){e.beginPath();const f=-m+g,y=-p,C=-m+g+h,I=-p+h;e.moveTo(f,y),e.lineTo(C,I),e.stroke()}e.restore();return}if(n.shape==="circle"){const[c,l]=So(o,[n.center.x,n.center.y]),A=n.radius*Math.abs(o.a),u=a*Math.abs(o.a);e.save(),e.translate(c,l),e.beginPath(),e.arc(0,0,A,0,Math.PI*2),e.fillStyle=s,e.fill(),e.beginPath(),e.arc(0,0,A,0,Math.PI*2),e.clip();const d=A*2;e.strokeStyle=r,e.lineWidth=.15*Math.abs(o.a),e.setLineDash([]);for(let _=-d;_<d*2;_+=u)e.beginPath(),e.moveTo(_-d,-d),e.lineTo(_+d,d),e.stroke();e.restore();return}}var Uyo="rgba(255,255,255,0.5)";function zyo(t){const{ctx:e,pcbNoteDimension:n,realToCanvasMat:o}=t,i=n.color??Uyo;xbt({ctx:e,from:n.from,to:n.to,realToCanvasMat:o,color:i,fontSize:n.font_size,arrowSize:n.arrow_size,text:n.text,textRotation:n.text_ccw_rotation,offset:n.offset_distance&&n.offset_direction?{distance:n.offset_distance,direction:n.offset_direction}:void 0})}function Vyo(t){const{ctx:e,line:n,realToCanvasMat:o}=t,r=n.color??"rgb(89, 148, 220)",s=n.stroke_width??.1,a=n.is_dashed??!1,[c,l]=So(o,[n.x1,n.y1]),[A,u]=So(o,[n.x2,n.y2]),d=s*Math.abs(o.a);e.save(),a?e.setLineDash([d*2,d*2]):e.setLineDash([]),e.beginPath(),e.moveTo(c,l),e.lineTo(A,u),e.lineWidth=d,e.strokeStyle=r,e.lineCap="round",e.stroke(),e.restore()}function Yyo(t){const{ctx:e,path:n,realToCanvasMat:o}=t,r=n.color??"rgb(89, 148, 220)";if(!(!n.route||n.route.length<2))for(let s=0;s<n.route.length-1;s++){const a=n.route[s],c=n.route[s+1];!a||!c||VQ({ctx:e,start:{x:a.x,y:a.y},end:{x:c.x,y:c.y},strokeWidth:n.stroke_width??.1,stroke:r,realToCanvasMat:o})}}function Kyo(t){const{ctx:e,rect:n,realToCanvasMat:o}=t,r=n.color??"rgb(89, 148, 220)",s=n.is_filled??!1,a=n.has_stroke??!0,c=n.is_stroke_dashed??!1;U_({ctx:e,center:n.center,width:n.width,height:n.height,fill:s?r:void 0,stroke:a?r:void 0,strokeWidth:a?n.stroke_width:void 0,borderRadius:n.corner_radius,realToCanvasMat:o,isStrokeDashed:c})}var Wyo="rgb(89, 148, 220)";function jyo(t){const{ctx:e,text:n,realToCanvasMat:o}=t,i=Wyo,r=n.color??i,s=n.font_size??1;hO({ctx:e,text:n.text??"",x:n.anchor_position.x,y:n.anchor_position.y,fontSize:s,color:r,realToCanvasMat:o,anchorAlignment:n.anchor_alignment??"center"})}function Xyo(t){const{ctx:e,panel:n,realToCanvasMat:o,colorMap:i}=t,{width:r,height:s,center:a}=n;if(r!==void 0&&s!==void 0&&a){const c=r/2,l=s/2,A=[{x:a.x-c,y:a.y-l},{x:a.x+c,y:a.y-l},{x:a.x+c,y:a.y+l},{x:a.x-c,y:a.y+l}];kee({ctx:e,points:A,stroke:i.boardOutline,strokeWidth:.5,realToCanvasMat:o,closePath:!0})}}function _O(t,e){if(t.length<3||e===0)return t;let n=0,o=0;for(const r of t)n+=r.x,o+=r.y;n/=t.length,o/=t.length;const i=[];for(const r of t){const s=r.x-n,a=r.y-o,c=Math.sqrt(s*s+a*a);if(c>0){const l=s/c,A=a/c;i.push({x:r.x+l*e,y:r.y+A*e})}else i.push({x:r.x+e,y:r.y})}return i}function Ebt(t){const{ctx:e,hole:n,realToCanvasMat:o,colorMap:i,soldermaskMargin:r=0,drawSoldermask:s}=t;if(n.is_covered_with_solder_mask===!0&&s)return;const a=i.copper[t.layer??"top"],c=r<0?Math.abs(r):0;if(n.shape==="circle"){z_({ctx:e,center:{x:n.x,y:n.y},radius:n.outer_diameter/2-c,fill:a,realToCanvasMat:o}),rE(e,()=>{z_({ctx:e,center:{x:n.x,y:n.y},radius:n.hole_diameter/2,fill:"#000",realToCanvasMat:o})}),z_({ctx:e,center:{x:n.x,y:n.y},radius:n.hole_diameter/2,fill:i.drill,realToCanvasMat:o});return}if(n.shape==="oval"){iE({ctx:e,center:{x:n.x,y:n.y},radius_x:n.outer_width/2-c,radius_y:n.outer_height/2-c,fill:a,realToCanvasMat:o,rotation:n.ccw_rotation}),rE(e,()=>{iE({ctx:e,center:{x:n.x,y:n.y},radius_x:n.hole_width/2,radius_y:n.hole_height/2,fill:"#000",realToCanvasMat:o,rotation:n.ccw_rotation})}),iE({ctx:e,center:{x:n.x,y:n.y},radius_x:n.hole_width/2,radius_y:n.hole_height/2,fill:i.drill,realToCanvasMat:o,rotation:n.ccw_rotation});return}if(n.shape==="pill"){Tm({ctx:e,center:{x:n.x,y:n.y},width:n.outer_width-c*2,height:n.outer_height-c*2,fill:a,realToCanvasMat:o,rotation:n.ccw_rotation}),rE(e,()=>{Tm({ctx:e,center:{x:n.x,y:n.y},width:n.hole_width,height:n.hole_height,fill:"#000",realToCanvasMat:o,rotation:n.ccw_rotation})}),Tm({ctx:e,center:{x:n.x,y:n.y},width:n.hole_width,height:n.hole_height,fill:i.drill,realToCanvasMat:o,rotation:n.ccw_rotation});return}if(n.shape==="circular_hole_with_rect_pad"){U_({ctx:e,center:{x:n.x,y:n.y},width:n.rect_pad_width-c*2,height:n.rect_pad_height-c*2,fill:a,realToCanvasMat:o,borderRadius:n.rect_border_radius?Math.max(0,n.rect_border_radius-c):0,ccwRotationDegrees:n.rect_ccw_rotation});const l=n.x+(n.hole_offset_x??0),A=n.y+(n.hole_offset_y??0);rE(e,()=>{z_({ctx:e,center:{x:l,y:A},radius:n.hole_diameter/2,fill:"#000",realToCanvasMat:o})}),z_({ctx:e,center:{x:l,y:A},radius:n.hole_diameter/2,fill:i.drill,realToCanvasMat:o});return}if(n.shape==="pill_hole_with_rect_pad"){U_({ctx:e,center:{x:n.x,y:n.y},width:n.rect_pad_width-c*2,height:n.rect_pad_height-c*2,fill:a,realToCanvasMat:o,borderRadius:n.rect_border_radius?Math.max(0,n.rect_border_radius-c):0});const l=n.x+(n.hole_offset_x??0),A=n.y+(n.hole_offset_y??0);rE(e,()=>{Tm({ctx:e,center:{x:l,y:A},width:n.hole_width,height:n.hole_height,fill:"#000",realToCanvasMat:o})}),Tm({ctx:e,center:{x:l,y:A},width:n.hole_width,height:n.hole_height,fill:i.drill,realToCanvasMat:o});return}if(n.shape==="rotated_pill_hole_with_rect_pad"){U_({ctx:e,center:{x:n.x,y:n.y},width:n.rect_pad_width-c*2,height:n.rect_pad_height-c*2,fill:a,realToCanvasMat:o,borderRadius:n.rect_border_radius?Math.max(0,n.rect_border_radius-c):0,ccwRotationDegrees:n.rect_ccw_rotation});const l=n.x+(n.hole_offset_x??0),A=n.y+(n.hole_offset_y??0);rE(e,()=>{Tm({ctx:e,center:{x:l,y:A},width:n.hole_width,height:n.hole_height,fill:"#000",realToCanvasMat:o,rotation:n.hole_ccw_rotation})}),Tm({ctx:e,center:{x:l,y:A},width:n.hole_width,height:n.hole_height,fill:i.drill,realToCanvasMat:o,rotation:n.hole_ccw_rotation});return}if(n.shape==="hole_with_polygon_pad"){const l=n.pad_outline;if(l&&l.length>=3){const _=l.map(m=>({x:n.x+m.x,y:n.y+m.y})),h=c>0?_O(_,-c):_;h.length>=3&&cv({ctx:e,points:h,fill:a,realToCanvasMat:o})}const A=n.x+(n.hole_offset_x??0),u=n.y+(n.hole_offset_y??0),d=n.hole_shape;d==="circle"?(rE(e,()=>{z_({ctx:e,center:{x:A,y:u},radius:(n.hole_diameter??0)/2,fill:"#000",realToCanvasMat:o})}),z_({ctx:e,center:{x:A,y:u},radius:(n.hole_diameter??0)/2,fill:i.drill,realToCanvasMat:o})):d==="oval"?(rE(e,()=>{iE({ctx:e,center:{x:A,y:u},radius_x:(n.hole_width??0)/2,radius_y:(n.hole_height??0)/2,fill:"#000",realToCanvasMat:o})}),iE({ctx:e,center:{x:A,y:u},radius_x:(n.hole_width??0)/2,radius_y:(n.hole_height??0)/2,fill:i.drill,realToCanvasMat:o})):d==="pill"?(rE(e,()=>{Tm({ctx:e,center:{x:A,y:u},width:n.hole_width??0,height:n.hole_height??0,fill:"#000",realToCanvasMat:o})}),Tm({ctx:e,center:{x:A,y:u},width:n.hole_width??0,height:n.hole_height??0,fill:i.drill,realToCanvasMat:o})):d==="rotated_pill"&&(rE(e,()=>{Tm({ctx:e,center:{x:A,y:u},width:n.hole_width??0,height:n.hole_height??0,fill:"#000",realToCanvasMat:o})}),Tm({ctx:e,center:{x:A,y:u},width:n.hole_width??0,height:n.hole_height??0,fill:i.drill,realToCanvasMat:o}));return}}function rE(t,e){t.save(),t.globalCompositeOperation="destination-out",e(),t.restore()}function Jyo(t,e){return t==="bottom"?e.silkscreen.bottom:e.silkscreen.top}function qyo(t){const{ctx:e,circle:n,realToCanvasMat:o,colorMap:i}=t,r=Jyo(n.layer,i);z_({ctx:e,center:n.center,radius:n.radius,stroke:r,strokeWidth:n.stroke_width,realToCanvasMat:o})}function $yo(t,e){return t==="bottom"?e.silkscreen.bottom:e.silkscreen.top}function Zyo(t){const{ctx:e,line:n,realToCanvasMat:o,colorMap:i}=t,r=$yo(n.layer,i);VQ({ctx:e,start:{x:n.x1,y:n.y1},end:{x:n.x2,y:n.y2},strokeWidth:n.stroke_width??.1,stroke:r,realToCanvasMat:o})}function eCo(t,e){return t==="bottom"?e.silkscreen.bottom:e.silkscreen.top}function tCo(t){const{ctx:e,oval:n,realToCanvasMat:o,colorMap:i}=t,r=eCo(n.layer,i);iE({ctx:e,center:n.center,radius_x:n.radius_x,radius_y:n.radius_y,stroke:r,strokeWidth:.1,realToCanvasMat:o,rotation:n.ccw_rotation??0})}function nCo(t,e){return t==="bottom"?e.silkscreen.bottom:e.silkscreen.top}function oCo(t){const{ctx:e,path:n,realToCanvasMat:o,colorMap:i}=t,r=nCo(n.layer,i);if(!(!n.route||n.route.length<2))for(let s=0;s<n.route.length-1;s++){const a=n.route[s],c=n.route[s+1];!a||!c||VQ({ctx:e,start:{x:a.x,y:a.y},end:{x:c.x,y:c.y},strokeWidth:n.stroke_width??.1,stroke:r,realToCanvasMat:o})}}function iCo(t,e){return t==="bottom"?e.silkscreen.bottom:e.silkscreen.top}function rCo(t){const{ctx:e,pill:n,realToCanvasMat:o,colorMap:i}=t,r=iCo(n.layer,i);Tm({ctx:e,center:n.center,width:n.width,height:n.height,stroke:r,strokeWidth:.2,realToCanvasMat:o})}function sCo(t,e){return t==="bottom"?e.silkscreen.bottom:e.silkscreen.top}function aCo(t){const{ctx:e,rect:n,realToCanvasMat:o,colorMap:i}=t,r=sCo(n.layer,i);U_({ctx:e,center:n.center,width:n.width,height:n.height,fill:n.is_filled?r:"transparent",stroke:r,strokeWidth:n.stroke_width,realToCanvasMat:o})}function cCo(t,e){return t==="bottom"?e.silkscreen.bottom:e.silkscreen.top}function lCo(t){return t||"center"}function ACo(t){const{ctx:e,text:n,realToCanvasMat:o,colorMap:i}=t,r=n.text??"";if(!r)return;const s=cCo(n.layer,i),a=lCo(n.anchor_alignment),c=n.font_size??1;hO({ctx:e,text:r,x:n.anchor_position.x,y:n.anchor_position.y,fontSize:c,color:s,realToCanvasMat:o,anchorAlignment:a,rotation:n.ccw_rotation??0,mirrorX:n.layer==="bottom",knockout:n.is_knockout,knockoutPadding:n.is_knockout?n.knockout_padding:void 0})}function uCo(t,e){return e.copper[t]??e.copper.top}function bbt(t){return t.shape==="rect"||t.shape==="rotated_rect"?t.corner_radius??t.rect_border_radius??0:0}function dCo(t){const{ctx:e,pad:n,realToCanvasMat:o,colorMap:i}=t,r=uCo(n.layer,i);if(n.shape==="rect"){U_({ctx:e,center:{x:n.x,y:n.y},width:n.width,height:n.height,fill:r,realToCanvasMat:o,borderRadius:bbt(n)});return}if(n.shape==="rotated_rect"){U_({ctx:e,center:{x:n.x,y:n.y},width:n.width,height:n.height,fill:r,realToCanvasMat:o,borderRadius:bbt(n),ccwRotationDegrees:n.ccw_rotation??0});return}if(n.shape==="circle"){z_({ctx:e,center:{x:n.x,y:n.y},radius:n.radius,fill:r,realToCanvasMat:o});return}if(n.shape==="pill"){Tm({ctx:e,center:{x:n.x,y:n.y},width:n.width,height:n.height,fill:r,realToCanvasMat:o});return}if(n.shape==="rotated_pill"){Tm({ctx:e,center:{x:n.x,y:n.y},width:n.width,height:n.height,fill:r,realToCanvasMat:o,rotation:n.ccw_rotation??0});return}if(n.shape==="polygon"){n.points&&n.points.length>=3&&cv({ctx:e,points:n.points,fill:r,realToCanvasMat:o});return}}function lv(t){const{ctx:e,points:n}=t;if(n.length<3)return;const o=n[0];if(o){e.moveTo(o.x,o.y);for(let i=1;i<n.length;i++){const r=n[i];r&&e.lineTo(r.x,r.y)}e.closePath()}}function Sbt(t){const{ctx:e,board:n,realToCanvasMat:o,soldermaskColor:i}=t,{width:r,height:s,center:a,outline:c}=n;if(c&&Array.isArray(c)&&c.length>=3){const l=c.map(A=>{const[u,d]=So(o,[A.x,A.y]);return{x:u,y:d}});e.beginPath(),lv({ctx:e,points:l}),e.fillStyle=i,e.fill()}else if(r!==void 0&&s!==void 0&&a){const[l,A]=So(o,[a.x,a.y]),u=r*Math.abs(o.a),d=s*Math.abs(o.a);e.fillStyle=i,e.fillRect(l-u/2,A-d/2,u,d)}}function hCo(t){return"createPattern"in t&&typeof Reflect.get(t,"createPattern")=="function"}function _Co(t,e){if(t===e||e.canvas.width<=0||e.canvas.height<=0||!hCo(t))return;let n=null;try{n=t.createPattern(e.canvas,"no-repeat")}catch{return}n&&(t.save(),t.globalCompositeOperation="source-over",t.fillStyle=n,t.fillRect(0,0,e.canvas.width,e.canvas.height),t.restore())}function mCo(t){return typeof t=="function"}function gCo(t,e,n){if(e<=0||n<=0)return null;const o=globalThis;let i=null;if("OffscreenCanvas"in o&&typeof o.OffscreenCanvas=="function")i=new o.OffscreenCanvas(e,n);else if("document"in o&&o.document&&typeof o.document.createElement=="function"){const r=o.document.createElement("canvas");r.width=e,r.height=n,i=r}else{const r=t.canvas.constructor;if(mCo(r))try{i=new r(e,n)}catch{return null}}return i?i.getContext("2d"):null}function pCo(t){const{ctx:e,panel:n,realToCanvasMat:o,soldermaskColor:i}=t,{width:r,height:s,center:a}=n;if(r===void 0||s===void 0||!a)return;const[c,l]=So(o,[a.x,a.y]),A=r*Math.abs(o.a),u=s*Math.abs(o.a);e.fillStyle=i,e.fillRect(c-A/2,l-u/2,A,u)}function Dx(t){const{ctx:e,cx:n,cy:o,width:i,height:r,radius:s,ccwRotationDegrees:a=0}=t,c=a*Math.PI/180,l=vPe(av(n,o),fbt(-c)),A=i/2,u=r/2,d=Math.min(s,A,u);if(d>0){const _=So(l,{x:-A,y:-u}),h=So(l,{x:A,y:-u}),m=So(l,{x:A,y:u}),p=So(l,{x:-A,y:u}),g=So(l,{x:-A,y:0});e.moveTo(g.x,g.y),e.arcTo(_.x,_.y,h.x,h.y,d),e.arcTo(h.x,h.y,m.x,m.y,d),e.arcTo(m.x,m.y,p.x,p.y,d),e.arcTo(p.x,p.y,_.x,_.y,d)}else{const _=So(l,{x:-A,y:-u}),h=So(l,{x:A,y:-u}),m=So(l,{x:A,y:u}),p=So(l,{x:-A,y:u});e.moveTo(_.x,_.y),e.lineTo(h.x,h.y),e.lineTo(m.x,m.y),e.lineTo(p.x,p.y)}e.closePath()}function Qx(t){t.save(),t.globalCompositeOperation="destination-out",t.fill(),t.restore()}function fCo(t){const{ctx:e,cutout:n,realToCanvasMat:o}=t;if(n.shape==="rect"){const[i,r]=So(o,[n.center?.x??0,n.center?.y??0]),s=n.width*Math.abs(o.a),a=n.height*Math.abs(o.a),c=(n.corner_radius??0)*Math.abs(o.a);e.save(),e.translate(i,r),n.rotation&&e.rotate(-n.rotation*Math.PI/180),e.beginPath(),Dx({ctx:e,cx:0,cy:0,width:s,height:a,radius:c}),e.restore(),Qx(e)}else if(n.shape==="circle"){const[i,r]=So(o,[n.center?.x??0,n.center?.y??0]),s=n.radius*Math.abs(o.a);e.beginPath(),e.arc(i,r,s,0,Math.PI*2),e.closePath(),Qx(e)}else if(n.shape==="polygon"&&n.points&&n.points.length>=3){const i=n.points.map(r=>{const[s,a]=So(o,[r.x,r.y]);return{x:s,y:a}});e.beginPath(),lv({ctx:e,points:i}),Qx(e)}}var Bg="rgba(255, 255, 255, 1)";function DPe(t){const{ctx:e,elements:n,layer:o,realToCanvasMat:i}=t;e.save(),e.globalCompositeOperation="destination-out";for(const r of n){if(r.type==="pcb_smtpad"){if(r.layer!==o||r.is_covered_with_solder_mask===!0)continue;yCo({ctx:e,pad:r,realToCanvasMat:i});continue}if(r.type==="pcb_plated_hole"){if(r.layers&&!r.layers.includes(o)||r.is_covered_with_solder_mask===!0)continue;CCo({ctx:e,hole:r,realToCanvasMat:i});continue}if(r.type==="pcb_via"){if(r.layers&&!r.layers.includes(o))continue;z_({ctx:e,center:{x:r.x,y:r.y},radius:r.outer_diameter/2,fill:Bg,realToCanvasMat:i});continue}if(r.type==="pcb_hole"){if(r.is_covered_with_solder_mask===!0)continue;xCo({ctx:e,hole:r,realToCanvasMat:i})}}e.restore()}function yCo(t){const{ctx:e,pad:n,realToCanvasMat:o}=t;if(n.shape==="rect"){U_({ctx:e,center:{x:n.x,y:n.y},width:n.width,height:n.height,borderRadius:n.corner_radius??n.rect_border_radius??0,fill:Bg,realToCanvasMat:o});return}if(n.shape==="rotated_rect"){U_({ctx:e,center:{x:n.x,y:n.y},width:n.width,height:n.height,borderRadius:n.corner_radius??n.rect_border_radius??0,ccwRotationDegrees:n.ccw_rotation??0,fill:Bg,realToCanvasMat:o});return}if(n.shape==="circle"){z_({ctx:e,center:{x:n.x,y:n.y},radius:n.radius,fill:Bg,realToCanvasMat:o});return}if(n.shape==="pill"||n.shape==="rotated_pill"){Tm({ctx:e,center:{x:n.x,y:n.y},width:n.width,height:n.height,rotation:n.shape==="rotated_pill"?n.ccw_rotation??0:0,fill:Bg,realToCanvasMat:o});return}n.shape==="polygon"&&n.points&&n.points.length>=3&&cv({ctx:e,points:n.points,fill:Bg,realToCanvasMat:o})}function CCo(t){const{ctx:e,hole:n,realToCanvasMat:o}=t;if(n.shape==="circle"){z_({ctx:e,center:{x:n.x,y:n.y},radius:n.outer_diameter/2,fill:Bg,realToCanvasMat:o});return}if(n.shape==="oval"){iE({ctx:e,center:{x:n.x,y:n.y},radius_x:n.outer_width/2,radius_y:n.outer_height/2,rotation:n.ccw_rotation,fill:Bg,realToCanvasMat:o});return}if(n.shape==="pill"){Tm({ctx:e,center:{x:n.x,y:n.y},width:n.outer_width,height:n.outer_height,rotation:n.ccw_rotation,fill:Bg,realToCanvasMat:o});return}if(n.shape==="circular_hole_with_rect_pad"){U_({ctx:e,center:{x:n.x,y:n.y},width:n.rect_pad_width,height:n.rect_pad_height,borderRadius:n.rect_border_radius??0,ccwRotationDegrees:n.rect_ccw_rotation,fill:Bg,realToCanvasMat:o});return}if(n.shape==="pill_hole_with_rect_pad"){U_({ctx:e,center:{x:n.x,y:n.y},width:n.rect_pad_width,height:n.rect_pad_height,borderRadius:n.rect_border_radius??0,fill:Bg,realToCanvasMat:o});return}if(n.shape==="rotated_pill_hole_with_rect_pad"){U_({ctx:e,center:{x:n.x,y:n.y},width:n.rect_pad_width,height:n.rect_pad_height,borderRadius:n.rect_border_radius??0,ccwRotationDegrees:n.rect_ccw_rotation,fill:Bg,realToCanvasMat:o});return}n.shape==="hole_with_polygon_pad"&&n.pad_outline&&n.pad_outline.length>=3&&cv({ctx:e,points:n.pad_outline.map(i=>({x:n.x+i.x,y:n.y+i.y})),fill:Bg,realToCanvasMat:o})}function xCo(t){const{ctx:e,hole:n,realToCanvasMat:o}=t,i="ccw_rotation"in n&&typeof n.ccw_rotation=="number"?n.ccw_rotation:0;if(n.hole_shape==="circle"){z_({ctx:e,center:{x:n.x,y:n.y},radius:n.hole_diameter/2,fill:Bg,realToCanvasMat:o});return}if(n.hole_shape==="square"){U_({ctx:e,center:{x:n.x,y:n.y},width:n.hole_diameter,height:n.hole_diameter,ccwRotationDegrees:i,fill:Bg,realToCanvasMat:o});return}if(n.hole_shape==="oval"){iE({ctx:e,center:{x:n.x,y:n.y},radius_x:n.hole_width/2,radius_y:n.hole_height/2,rotation:i,fill:Bg,realToCanvasMat:o});return}if(n.hole_shape==="rect"){U_({ctx:e,center:{x:n.x,y:n.y},width:n.hole_width,height:n.hole_height,ccwRotationDegrees:i,fill:Bg,realToCanvasMat:o});return}(n.hole_shape==="pill"||n.hole_shape==="rotated_pill")&&Tm({ctx:e,center:{x:n.x,y:n.y},width:n.hole_width,height:n.hole_height,rotation:i,fill:Bg,realToCanvasMat:o})}function ICo(t,e,n,o,i){if(Math.abs(i)<1e-10)return null;const r=n-t,s=o-e,a=Math.hypot(r,s);if(a<1e-10)return null;const c=Math.abs(i)*(a/2),l=a/2,A=(c*c+l*l)/(2*c),u=A-c,d=(t+n)/2,_=(e+o)/2,h=-s/a,m=r/a,p=i>0?-1:1;return{centerX:d+p*h*u,centerY:_+p*m*u,radius:A}}function QPe(t,e,n,o,i,r,s){if(Math.abs(r)<1e-10){const[C,I]=So(s,[o,i]);t.lineTo(C,I);return}const a=ICo(e,n,o,i,r);if(!a){const[C,I]=So(s,[o,i]);t.lineTo(C,I);return}const[c,l]=So(s,[e,n]),[A,u]=So(s,[o,i]),[d,_]=So(s,[a.centerX,a.centerY]),h=Math.hypot(c-d,l-_),m=Math.atan2(l-_,c-d),p=Math.atan2(u-_,A-d),f=s.a*s.d-s.b*s.c<0,y=r>0?!f:f;t.arc(d,_,h,m,p,y)}function Pbt(t,e,n){if(e.vertices.length<2)return;if(e.vertices.length===2){const s=e.vertices[0],a=e.vertices[1];if(s&&a&&Math.abs((s.bulge??0)-1)<1e-10&&Math.abs((a.bulge??0)-1)<1e-10){const[c,l]=So(n,[s.x,s.y]);t.moveTo(c,l),QPe(t,s.x,s.y,a.x,a.y,1,n),QPe(t,a.x,a.y,s.x,s.y,1,n);return}}const o=e.vertices[0];if(!o)return;const[i,r]=So(n,[o.x,o.y]);t.moveTo(i,r);for(let s=0;s<e.vertices.length;s++){const a=e.vertices[s],c=e.vertices[(s+1)%e.vertices.length];if(!a||!c)continue;const l=a.bulge??0;if(Math.abs(l)<1e-10){const[A,u]=So(n,[c.x,c.y]);t.lineTo(A,u)}else QPe(t,a.x,a.y,c.x,c.y,l,n)}}function ECo(t){const{ctx:e,pour:n,realToCanvasMat:o,soldermaskOverCopperColor:i,layer:r,elements:s}=t;if(n.layer===r&&n.covered_with_solder_mask===!0){if(e.save(),e.fillStyle=i,n.shape==="rect"){const[a,c]=So(o,[n.center.x,n.center.y]),l=n.width*Math.abs(o.a),A=n.height*Math.abs(o.a);e.translate(a,c),n.rotation&&e.rotate(-n.rotation*(Math.PI/180)),e.beginPath(),e.rect(-l/2,-A/2,l,A),e.fill(),e.restore(),DPe({ctx:e,elements:s,layer:r,realToCanvasMat:o});return}if(n.shape==="polygon"){if(n.points&&n.points.length>=3){const a=n.points.map(l=>So(o,[l.x,l.y])),c=a[0];if(c){e.beginPath();const[l,A]=c;e.moveTo(l,A);for(let u=1;u<a.length;u++){const d=a[u];if(!d)continue;const[_,h]=d;e.lineTo(_,h)}e.closePath(),e.fill(),DPe({ctx:e,elements:s,layer:r,realToCanvasMat:o})}}e.restore();return}if(n.shape==="brep"){if(e.beginPath(),Pbt(e,n.brep_shape.outer_ring,o),n.brep_shape.inner_rings)for(const a of n.brep_shape.inner_rings)Pbt(e,a,o);e.fill("evenodd"),DPe({ctx:e,elements:s,layer:r,realToCanvasMat:o}),e.restore();return}e.restore()}}function Vb(t){const{ctx:e,cx:n,cy:o,width:i,height:r,ccwRotationDegrees:s=0}=t,a=s*Math.PI/180,c=vPe(av(n,o),fbt(-a));if(i>r){const l=r/2,A=(i-r)/2,u=So(c,{x:-A,y:0}),d=So(c,{x:A,y:0}),_=So(c,{x:A,y:-l});e.moveTo(_.x,_.y),e.arc(d.x,d.y,l,-a-Math.PI/2,-a+Math.PI/2),e.arc(u.x,u.y,l,-a+Math.PI/2,-a-Math.PI/2)}else if(r>i){const l=i/2,A=(r-i)/2,u=So(c,{x:0,y:-A}),d=So(c,{x:0,y:A}),_=So(c,{x:l,y:A});e.moveTo(_.x,_.y),e.arc(d.x,d.y,l,-a,-a+Math.PI),e.arc(u.x,u.y,l,-a+Math.PI,-a)}else{const l=i/2;e.moveTo(n+l,o),e.arc(n,o,l,0,Math.PI*2)}e.closePath()}function bCo(t){const{ctx:e,hole:n,realToCanvasMat:o,soldermaskOverCopperColor:i}=t,r=n.is_covered_with_solder_mask===!0,s=n.soldermask_margin??0;r?(e.fillStyle=i,Lee({ctx:e,hole:n,realToCanvasMat:o,margin:0}),e.fill()):s<0?(Lee({ctx:e,hole:n,realToCanvasMat:o,margin:s}),Qx(e),SCo({ctx:e,hole:n,realToCanvasMat:o,soldermaskOverCopperColor:i,margin:s})):s>0?(Lee({ctx:e,hole:n,realToCanvasMat:o,margin:s}),Qx(e)):(Lee({ctx:e,hole:n,realToCanvasMat:o,margin:0}),Qx(e))}function vbt(t){return"ccw_rotation"in t&&typeof t.ccw_rotation=="number"?t.ccw_rotation:0}function Lee(t){const{ctx:e,hole:n,realToCanvasMat:o,margin:i}=t,r=vbt(n);if(n.hole_shape==="circle"){const[s,a]=So(o,[n.x,n.y]),c=(n.hole_diameter/2+i)*Math.abs(o.a);e.beginPath(),e.arc(s,a,c,0,Math.PI*2),e.closePath()}else if(n.hole_shape==="square"){const[s,a]=So(o,[n.x,n.y]),c=(n.hole_diameter+i*2)*Math.abs(o.a);e.save(),e.translate(s,a),r!==0&&e.rotate(-r*Math.PI/180),e.beginPath(),e.rect(-c/2,-c/2,c,c),e.closePath(),e.restore()}else if(n.hole_shape==="oval"){const[s,a]=So(o,[n.x,n.y]),c=(n.hole_width/2+i)*Math.abs(o.a),l=(n.hole_height/2+i)*Math.abs(o.a);e.save(),e.translate(s,a),r!==0&&e.rotate(-r*Math.PI/180),e.beginPath(),e.ellipse(0,0,c,l,0,0,Math.PI*2),e.closePath(),e.restore()}else if(n.hole_shape==="rect"){const[s,a]=So(o,[n.x,n.y]),c=(n.hole_width+i*2)*Math.abs(o.a),l=(n.hole_height+i*2)*Math.abs(o.a);e.save(),e.translate(s,a),r!==0&&e.rotate(-r*Math.PI/180),e.beginPath(),e.rect(-c/2,-l/2,c,l),e.closePath(),e.restore()}else if(n.hole_shape==="pill"||n.hole_shape==="rotated_pill"){const[s,a]=So(o,[n.x,n.y]),c=(n.hole_width+i*2)*Math.abs(o.a),l=(n.hole_height+i*2)*Math.abs(o.a);e.save(),e.translate(s,a),r!==0&&e.rotate(-r*Math.PI/180),e.beginPath(),Vb({ctx:e,cx:0,cy:0,width:c,height:l}),e.restore()}}function SCo(t){const{ctx:e,hole:n,realToCanvasMat:o,soldermaskOverCopperColor:i,margin:r}=t,s=Math.abs(r),a=vbt(n);if(e.fillStyle=i,n.hole_shape==="circle"){const[c,l]=So(o,[n.x,n.y]),A=n.hole_diameter/2*Math.abs(o.a),u=s*Math.abs(o.a),d=Math.max(0,A-u);e.save(),e.beginPath(),e.arc(c,l,A,0,Math.PI*2),d>0&&e.arc(c,l,d,0,Math.PI*2,!0),e.fill("evenodd"),e.restore()}else if(n.hole_shape==="square"){const[c,l]=So(o,[n.x,n.y]),A=n.hole_diameter*Math.abs(o.a),u=s*Math.abs(o.a),d=Math.max(0,A-u*2);e.save(),e.translate(c,l),a!==0&&e.rotate(-a*Math.PI/180),e.beginPath(),e.rect(-A/2,-A/2,A,A),d>0&&e.rect(-d/2,-d/2,d,d),e.fill("evenodd"),e.restore()}else if(n.hole_shape==="oval"){const[c,l]=So(o,[n.x,n.y]),A=n.hole_width/2*Math.abs(o.a),u=n.hole_height/2*Math.abs(o.a),d=s*Math.abs(o.a),_=Math.max(0,A-d),h=Math.max(0,u-d);e.save(),e.translate(c,l),a!==0&&e.rotate(-a*Math.PI/180),e.beginPath(),e.ellipse(0,0,A,u,0,0,Math.PI*2),_>0&&h>0&&(e.moveTo(_,0),e.ellipse(0,0,_,h,0,0,Math.PI*2)),e.fill("evenodd"),e.restore()}else if(n.hole_shape==="rect"){const[c,l]=So(o,[n.x,n.y]),A=n.hole_width*Math.abs(o.a),u=n.hole_height*Math.abs(o.a),d=s*Math.abs(o.a),_=Math.max(0,A-d*2),h=Math.max(0,u-d*2);e.save(),e.translate(c,l),a!==0&&e.rotate(-a*Math.PI/180),e.beginPath(),e.rect(-A/2,-u/2,A,u),_>0&&h>0&&e.rect(-_/2,-h/2,_,h),e.fill("evenodd"),e.restore()}else if(n.hole_shape==="pill"||n.hole_shape==="rotated_pill"){const[c,l]=So(o,[n.x,n.y]),A=n.hole_width*Math.abs(o.a),u=n.hole_height*Math.abs(o.a),d=s*Math.abs(o.a);e.save(),e.translate(c,l),a!==0&&e.rotate(-a*Math.PI/180),e.beginPath(),Vb({ctx:e,cx:0,cy:0,width:A,height:u});const _=A-d*2,h=u-d*2;_>0&&h>0&&Vb({ctx:e,cx:0,cy:0,width:_,height:h}),e.fill("evenodd"),e.restore()}}function PCo(t){const{ctx:e,hole:n,realToCanvasMat:o,soldermaskOverCopperColor:i,layer:r}=t;if(n.layers&&!n.layers.includes(r))return;const s=n.is_covered_with_solder_mask===!0,a=n.soldermask_margin??0;s?(e.fillStyle=i,Fee({ctx:e,hole:n,realToCanvasMat:o,margin:0}),e.fill()):a<0?(Fee({ctx:e,hole:n,realToCanvasMat:o,margin:a}),Qx(e),vCo({ctx:e,hole:n,realToCanvasMat:o,soldermaskOverCopperColor:i,margin:a})):a>0?(Fee({ctx:e,hole:n,realToCanvasMat:o,margin:a}),Qx(e)):(Fee({ctx:e,hole:n,realToCanvasMat:o,margin:0}),Qx(e))}function Fee(t){const{ctx:e,hole:n,realToCanvasMat:o,margin:i}=t;if(n.shape==="circle"){const[r,s]=So(o,[n.x,n.y]),a=(n.outer_diameter/2+i)*Math.abs(o.a);e.beginPath(),e.arc(r,s,a,0,Math.PI*2),e.closePath()}else if(n.shape==="oval"){const[r,s]=So(o,[n.x,n.y]),a=(n.outer_width/2+i)*Math.abs(o.a),c=(n.outer_height/2+i)*Math.abs(o.a);e.beginPath(),e.ellipse(r,s,a,c,-((n.ccw_rotation??0)*Math.PI)/180,0,Math.PI*2),e.closePath()}else if(n.shape==="pill"){const[r,s]=So(o,[n.x,n.y]),a=(n.outer_width+i*2)*Math.abs(o.a),c=(n.outer_height+i*2)*Math.abs(o.a);e.beginPath(),Vb({ctx:e,cx:r,cy:s,width:a,height:c,ccwRotationDegrees:n.ccw_rotation})}else if(n.shape==="circular_hole_with_rect_pad"){const[r,s]=So(o,[n.x,n.y]),a=(n.rect_pad_width+i*2)*Math.abs(o.a),c=(n.rect_pad_height+i*2)*Math.abs(o.a),l=(n.rect_border_radius??0)*Math.abs(o.a);e.beginPath(),Dx({ctx:e,cx:r,cy:s,width:a,height:c,radius:l,ccwRotationDegrees:n.rect_ccw_rotation})}else if(n.shape==="pill_hole_with_rect_pad"){const[r,s]=So(o,[n.x,n.y]),a=(n.rect_pad_width+i*2)*Math.abs(o.a),c=(n.rect_pad_height+i*2)*Math.abs(o.a),l=(n.rect_border_radius??0)*Math.abs(o.a);e.beginPath(),Dx({ctx:e,cx:r,cy:s,width:a,height:c,radius:l})}else if(n.shape==="rotated_pill_hole_with_rect_pad"){const[r,s]=So(o,[n.x,n.y]),a=(n.rect_pad_width+i*2)*Math.abs(o.a),c=(n.rect_pad_height+i*2)*Math.abs(o.a),l=(n.rect_border_radius??0)*Math.abs(o.a);e.beginPath(),Dx({ctx:e,cx:r,cy:s,width:a,height:c,radius:l,ccwRotationDegrees:n.rect_ccw_rotation})}else if(n.shape==="hole_with_polygon_pad"&&n.pad_outline&&n.pad_outline.length>=3){const r=n.pad_outline.map(c=>({x:n.x+c.x,y:n.y+c.y})),a=(i!==0?_O(r,i):r).map(c=>{const[l,A]=So(o,[c.x,c.y]);return{x:l,y:A}});e.beginPath(),lv({ctx:e,points:a})}}function vCo(t){const{ctx:e,hole:n,realToCanvasMat:o,soldermaskOverCopperColor:i,margin:r}=t,s=Math.abs(r);if(e.fillStyle=i,n.shape==="circle"){const[a,c]=So(o,[n.x,n.y]),l=n.outer_diameter/2*Math.abs(o.a),A=s*Math.abs(o.a),u=Math.max(0,l-A);e.beginPath(),e.arc(a,c,l,0,Math.PI*2),u>0&&e.arc(a,c,u,0,Math.PI*2,!0),e.fill("evenodd")}else if(n.shape==="oval"){const[a,c]=So(o,[n.x,n.y]),l=n.outer_width/2*Math.abs(o.a),A=n.outer_height/2*Math.abs(o.a),u=s*Math.abs(o.a),d=Math.max(0,l-u),_=Math.max(0,A-u),h=-((n.ccw_rotation??0)*Math.PI)/180;if(e.beginPath(),e.ellipse(a,c,l,A,h,0,Math.PI*2),d>0&&_>0){const m=a+d*Math.cos(h),p=c+d*Math.sin(h);e.moveTo(m,p),e.ellipse(a,c,d,_,h,0,Math.PI*2)}e.fill("evenodd")}else if(n.shape==="pill"){const[a,c]=So(o,[n.x,n.y]),l=n.outer_width*Math.abs(o.a),A=n.outer_height*Math.abs(o.a),u=s*Math.abs(o.a);e.beginPath(),Vb({ctx:e,cx:a,cy:c,width:l,height:A,ccwRotationDegrees:n.ccw_rotation});const d=l-u*2,_=A-u*2;d>0&&_>0&&Vb({ctx:e,cx:a,cy:c,width:d,height:_,ccwRotationDegrees:n.ccw_rotation}),e.fill("evenodd")}else if(n.shape==="circular_hole_with_rect_pad"){const[a,c]=So(o,[n.x,n.y]),l=n.rect_pad_width*Math.abs(o.a),A=n.rect_pad_height*Math.abs(o.a),u=s*Math.abs(o.a),d=n.rect_border_radius?n.rect_border_radius*Math.abs(o.a):0;e.beginPath(),Dx({ctx:e,cx:a,cy:c,width:l,height:A,radius:d,ccwRotationDegrees:n.rect_ccw_rotation});const _=l-u*2,h=A-u*2;if(_>0&&h>0){const m=Math.max(0,d-u);Dx({ctx:e,cx:a,cy:c,width:_,height:h,radius:m,ccwRotationDegrees:n.rect_ccw_rotation})}e.fill("evenodd")}else if(n.shape==="pill_hole_with_rect_pad"){const[a,c]=So(o,[n.x,n.y]),l=n.rect_pad_width*Math.abs(o.a),A=n.rect_pad_height*Math.abs(o.a),u=s*Math.abs(o.a),d=n.rect_border_radius?n.rect_border_radius*Math.abs(o.a):0;e.beginPath(),Dx({ctx:e,cx:a,cy:c,width:l,height:A,radius:d});const _=l-u*2,h=A-u*2;if(_>0&&h>0){const m=Math.max(0,d-u);Dx({ctx:e,cx:a,cy:c,width:_,height:h,radius:m})}e.fill("evenodd")}else if(n.shape==="rotated_pill_hole_with_rect_pad"){const[a,c]=So(o,[n.x,n.y]),l=n.rect_pad_width*Math.abs(o.a),A=n.rect_pad_height*Math.abs(o.a),u=s*Math.abs(o.a),d=n.rect_border_radius?n.rect_border_radius*Math.abs(o.a):0;e.beginPath(),Dx({ctx:e,cx:a,cy:c,width:l,height:A,radius:d,ccwRotationDegrees:n.rect_ccw_rotation});const _=l-u*2,h=A-u*2;if(_>0&&h>0){const m=Math.max(0,d-u);Dx({ctx:e,cx:a,cy:c,width:_,height:h,radius:m,ccwRotationDegrees:n.rect_ccw_rotation})}e.fill("evenodd")}else if(n.shape==="hole_with_polygon_pad"&&n.pad_outline&&n.pad_outline.length>=3){const a=n.pad_outline.map(A=>({x:n.x+A.x,y:n.y+A.y}));e.beginPath();const c=a.map(A=>{const[u,d]=So(o,[A.x,A.y]);return{x:u,y:d}});lv({ctx:e,points:c});const l=_O(a,-s);if(l.length>=3){const A=l.map(u=>{const[d,_]=So(o,[u.x,u.y]);return{x:d,y:_}});lv({ctx:e,points:A})}e.fill("evenodd")}}function BCo(t){const{ctx:e,pad:n,realToCanvasMat:o,soldermaskOverCopperColor:i,layer:r}=t;if(n.layer!==r)return;const s=n.is_covered_with_solder_mask===!0,a=n.soldermask_margin??0;let c=a,l=a,A=a,u=a;(n.shape==="rect"||n.shape==="rotated_rect")&&(c=n.soldermask_margin_left??a,l=n.soldermask_margin_right??a,A=n.soldermask_margin_top??a,u=n.soldermask_margin_bottom??a),s?(e.fillStyle=i,Oee({ctx:e,pad:n,realToCanvasMat:o,ml:0,mr:0,mt:0,mb:0}),e.fill()):c<0||l<0||A<0||u<0?(Oee({ctx:e,pad:n,realToCanvasMat:o,ml:c,mr:l,mt:A,mb:u}),Qx(e),MCo({ctx:e,pad:n,realToCanvasMat:o,soldermaskOverCopperColor:i,ml:c,mr:l,mt:A,mb:u})):c>0||l>0||A>0||u>0?(Oee({ctx:e,pad:n,realToCanvasMat:o,ml:c,mr:l,mt:A,mb:u}),Qx(e)):(Oee({ctx:e,pad:n,realToCanvasMat:o,ml:0,mr:0,mt:0,mb:0}),Qx(e))}function Oee(t){const{ctx:e,pad:n,realToCanvasMat:o,ml:i,mr:r,mt:s,mb:a}=t,c=n.shape==="rotated_rect"||n.shape==="rotated_pill"?n.ccw_rotation??0:0;if(n.shape==="rect"||n.shape==="rotated_rect"){const l=n.corner_radius??n.rect_border_radius??0,A=c*Math.PI/180,u=(r-i)/2,d=(s-a)/2,_=u*Math.cos(A)-d*Math.sin(A),h=u*Math.sin(A)+d*Math.cos(A),[m,p]=So(o,[n.x+_,n.y+h]),g=(n.width+i+r)*Math.abs(o.a),f=(n.height+s+a)*Math.abs(o.a),y=l*Math.abs(o.a);e.save(),e.translate(m,p),c!==0&&e.rotate(-c*Math.PI/180),e.beginPath(),Dx({ctx:e,cx:0,cy:0,width:g,height:f,radius:y}),e.restore()}else if(n.shape==="circle"){const l=(i+r+s+a)/4,[A,u]=So(o,[n.x,n.y]),d=(n.radius+l)*Math.abs(o.a);e.beginPath(),e.arc(A,u,d,0,Math.PI*2),e.closePath()}else if(n.shape==="pill"||n.shape==="rotated_pill"){const l=(i+r)/2,[A,u]=So(o,[n.x,n.y]),d=(n.width+l*2)*Math.abs(o.a),_=(n.height+l*2)*Math.abs(o.a);e.save(),e.translate(A,u),c!==0&&e.rotate(-c*Math.PI/180),e.beginPath(),Vb({ctx:e,cx:0,cy:0,width:d,height:_}),e.restore()}else if(n.shape==="polygon"&&n.points&&n.points.length>=3){const l=(i+r+s+a)/4,u=(l!==0?_O(n.points,l):n.points).map(d=>{const[_,h]=So(o,[d.x,d.y]);return{x:_,y:h}});e.beginPath(),lv({ctx:e,points:u})}}function MCo(t){const{ctx:e,pad:n,realToCanvasMat:o,soldermaskOverCopperColor:i,ml:r,mr:s,mt:a,mb:c}=t,l=n.shape==="rotated_rect"||n.shape==="rotated_pill"?n.ccw_rotation??0:0,A=Math.max(0,-r),u=Math.max(0,-s),d=Math.max(0,-a),_=Math.max(0,-c);if(e.fillStyle=i,n.shape==="rect"||n.shape==="rotated_rect"){const h=n.corner_radius??n.rect_border_radius??0,[m,p]=So(o,[n.x,n.y]),g=n.width*Math.abs(o.a),f=n.height*Math.abs(o.a),y=h*Math.abs(o.a),C=A*Math.abs(o.a),I=u*Math.abs(o.a),E=d*Math.abs(o.a),b=_*Math.abs(o.a);e.save(),e.translate(m,p),l!==0&&e.rotate(-l*Math.PI/180),e.beginPath(),Dx({ctx:e,cx:0,cy:0,width:g,height:f,radius:y});const P=g-C-I,B=f-E-b,M=(C-I)/2,k=(E-b)/2,N=Math.max(0,y-(C+I+E+b)/4);P>0&&B>0&&Dx({ctx:e,cx:M,cy:k,width:P,height:B,radius:N}),e.fill("evenodd"),e.restore()}else if(n.shape==="circle"){const h=Math.max(A,u,d,_),[m,p]=So(o,[n.x,n.y]),g=n.radius*Math.abs(o.a),f=h*Math.abs(o.a),y=Math.max(0,g-f);e.save(),e.beginPath(),e.arc(m,p,g,0,Math.PI*2),y>0&&e.arc(m,p,y,0,Math.PI*2,!0),e.fill("evenodd"),e.restore()}else if(n.shape==="pill"||n.shape==="rotated_pill"){const h=Math.max(A,u,d,_),[m,p]=So(o,[n.x,n.y]),g=n.width*Math.abs(o.a),f=n.height*Math.abs(o.a),y=h*Math.abs(o.a);e.save(),e.translate(m,p),l!==0&&e.rotate(-l*Math.PI/180),e.beginPath(),Vb({ctx:e,cx:0,cy:0,width:g,height:f});const C=g-y*2,I=f-y*2;C>0&&I>0&&Vb({ctx:e,cx:0,cy:0,width:C,height:I}),e.fill("evenodd"),e.restore()}else if(n.shape==="polygon"&&n.points&&n.points.length>=3){const h=Math.max(A,u,d,_);e.save(),e.beginPath();const m=n.points.map(g=>{const[f,y]=So(o,[g.x,g.y]);return{x:f,y}});lv({ctx:e,points:m});const p=_O(n.points,-h);if(p.length>=3){const g=p.map(f=>{const[y,C]=So(o,[f.x,f.y]);return{x:y,y:C}});lv({ctx:e,points:g})}e.fill("evenodd"),e.restore()}}function YQ(t,e){const n=Math.hypot(t,e);return n<=Number.EPSILON?{x:0,y:0}:{x:t/n,y:e/n}}function wCo(t,e){const n=t.length;if(n<2)return{x:1,y:0};if(e<=0){const l=t[1],A=t[0];if(!l||!A)return{x:1,y:0};const u=YQ(l.x-A.x,l.y-A.y);return u.x===0&&u.y===0?{x:1,y:0}:u}if(e>=n-1){const l=t[n-2],A=t[n-1];if(!l||!A)return{x:1,y:0};const u=YQ(A.x-l.x,A.y-l.y);return u.x===0&&u.y===0?{x:1,y:0}:u}const o=t[e-1],i=t[e],r=t[e+1];if(!o||!i||!r)return{x:1,y:0};const s=YQ(i.x-o.x,i.y-o.y),a=YQ(r.x-i.x,r.y-i.y),c=YQ(s.x+a.x,s.y+a.y);return c.x===0&&c.y===0?s.x!==0||s.y!==0?s:a.x!==0||a.y!==0?a:{x:1,y:0}:c}function Bbt(t){const e=[],n=[];for(let o=0;o<t.length;o++){const i=t[o];if(!i)continue;const r=wCo(t,o),s=YQ(-r.y,r.x),a=i.width/2;e.push({x:i.x+s.x*a,y:i.y+s.y*a}),n.push({x:i.x-s.x*a,y:i.y-s.y*a})}return e.concat(n.reverse())}function TPe(t){const e=[];let n=[],o=null;for(const i of t??[]){if(!i||i.route_type!=="wire"){n.length>=2&&e.push(n),n=[],o=null;continue}const r=i.layer??o;if(!r)continue;const s=i.x,a=i.y;typeof s!="number"||typeof a!="number"||typeof i.width=="number"&&(i.width,o&&r!==o&&(n.length>=2&&e.push(n),n=[]),o=r,n.push(i))}return n.length>=2&&e.push(n),e}var Mbt=1e-6;function wbt(t){const{ctx:e,trace:n,realToCanvasMat:o,vias:i,platedHoles:r,layer:s}=t;if(!n.route||n.route.length<2)return;const a=TPe(n.route);if(a.length===0)return;const c=new Map;for(const l of a){const A=l[0]?.layer,u=l[l.length-1];if(!(!A||!u)&&!(s&&A!==s)){for(const d of i){if(d.layers&&Array.isArray(d.layers)&&!d.layers.includes(A)||!Dbt(u.x,u.y,d.x,d.y))continue;const _=d.hole_diameter/2;if(_<=0)continue;const h={shape:"circle",x:d.x,y:d.y,radius:_};c.set(Qbt(h),h)}for(const d of r){if(d.layers&&Array.isArray(d.layers)&&!d.layers.includes(A))continue;const _=DCo(d);_&&Dbt(u.x,u.y,_.x,_.y)&&c.set(Qbt(_),_)}}}if(c.size!==0){e.save(),e.globalCompositeOperation="destination-out";for(const l of c.values()){if(l.shape==="circle"){z_({ctx:e,center:{x:l.x,y:l.y},radius:l.radius,fill:"#000",realToCanvasMat:o});continue}if(l.shape==="oval"){iE({ctx:e,center:{x:l.x,y:l.y},radius_x:l.radiusX,radius_y:l.radiusY,fill:"#000",realToCanvasMat:o,rotation:l.rotation});continue}Tm({ctx:e,center:{x:l.x,y:l.y},width:l.width,height:l.height,fill:"#000",realToCanvasMat:o,rotation:l.rotation})}e.restore()}}function DCo(t){if(t.shape==="circle"){const i=t.hole_diameter/2;return i<=0?void 0:{shape:"circle",x:t.x,y:t.y,radius:i}}if(t.shape==="oval"){const i=t.hole_width/2,r=t.hole_height/2;return i<=0||r<=0?void 0:{shape:"oval",x:t.x,y:t.y,radiusX:i,radiusY:r,rotation:t.ccw_rotation}}if(t.shape==="pill")return t.hole_width<=0||t.hole_height<=0?void 0:{shape:"pill",x:t.x,y:t.y,width:t.hole_width,height:t.hole_height,rotation:t.ccw_rotation};if(t.shape==="circular_hole_with_rect_pad"){const i=t.hole_diameter/2;return i<=0?void 0:{shape:"circle",x:t.x+(t.hole_offset_x??0),y:t.y+(t.hole_offset_y??0),radius:i}}if(t.shape==="pill_hole_with_rect_pad")return t.hole_width<=0||t.hole_height<=0?void 0:{shape:"pill",x:t.x+(t.hole_offset_x??0),y:t.y+(t.hole_offset_y??0),width:t.hole_width,height:t.hole_height};if(t.shape==="rotated_pill_hole_with_rect_pad")return t.hole_width<=0||t.hole_height<=0?void 0:{shape:"pill",x:t.x+(t.hole_offset_x??0),y:t.y+(t.hole_offset_y??0),width:t.hole_width,height:t.hole_height,rotation:t.hole_ccw_rotation};if(t.shape!=="hole_with_polygon_pad")return;const e=t.x+(t.hole_offset_x??0),n=t.y+(t.hole_offset_y??0),o=t.hole_shape;if(o==="circle"){const i=(t.hole_diameter??0)/2;return i<=0?void 0:{shape:"circle",x:e,y:n,radius:i}}if(o==="oval"){const i=(t.hole_width??0)/2,r=(t.hole_height??0)/2;return i<=0||r<=0?void 0:{shape:"oval",x:e,y:n,radiusX:i,radiusY:r}}if(o==="pill"||o==="rotated_pill"){const i=t.hole_width??0,r=t.hole_height??0;return i<=0||r<=0?void 0:{shape:"pill",x:e,y:n,width:i,height:r,rotation:o==="rotated_pill"?t.ccw_rotation:0}}}function Dbt(t,e,n,o){return Math.abs(t-n)<=Mbt&&Math.abs(e-o)<=Mbt}function Qbt(t){return t.shape==="circle"?`circle:${t.x}:${t.y}:${t.radius}`:t.shape==="oval"?`oval:${t.x}:${t.y}:${t.radiusX}:${t.radiusY}:${t.rotation??0}`:`pill:${t.x}:${t.y}:${t.width}:${t.height}:${t.rotation??0}`}function Tbt(t){if(t.length<2)return!1;const e=t[0]?.width;return typeof e!="number"?!1:t.some(n=>Math.abs(n.width-e)>Number.EPSILON)}function QCo(t){const{ctx:e,trace:n,realToCanvasMat:o,soldermaskOverCopperColor:i,layer:r}=t;if(!n.route||!Array.isArray(n.route)||n.route.length<2)return;const s=TPe(n.route);for(const a of s)if(a[0]?.layer===r){if(Tbt(a)){const l=Bbt(a);cv({ctx:e,points:l,fill:i,realToCanvasMat:o});continue}for(let l=0;l<a.length-1;l++){const A=a[l],u=a[l+1];!A||!u||VQ({ctx:e,start:{x:A.x,y:A.y},end:{x:u.x,y:u.y},strokeWidth:A.width,stroke:i,realToCanvasMat:o,lineCap:"round"})}}wbt({ctx:e,trace:n,realToCanvasMat:o,layer:r,vias:t.vias,platedHoles:t.platedHoles})}function TCo(t){const{ctx:e,via:n,realToCanvasMat:o}=t,[i,r]=So(o,[n.x,n.y]),s=n.outer_diameter/2*Math.abs(o.a);e.beginPath(),e.arc(i,r,s,0,Math.PI*2),e.closePath(),Qx(e)}function Rbt(t){const{ctx:e,elements:n,realToCanvasMat:o,colorMap:i,layer:r,drawSoldermask:s}=t;if(!s||e.canvas.width<=0||e.canvas.height<=0)return;const a=n.filter(h=>h.type==="pcb_board"),c=n.find(h=>h.type==="pcb_panel");if(a.length===0&&!c)return;const l=i.soldermask[r]??i.soldermask.top,A=i.soldermaskOverCopper[r]??i.soldermaskOverCopper.top,u=n.filter(h=>h.type==="pcb_via"),d=n.filter(h=>h.type==="pcb_plated_hole"),_=gCo(e,e.canvas.width,e.canvas.height)??e;if(c&&pCo({ctx:_,panel:c,realToCanvasMat:o,soldermaskColor:l}),c&&a.length>0){_.save(),_.globalCompositeOperation="destination-out";for(const h of a)Sbt({ctx:_,board:h,realToCanvasMat:o,soldermaskColor:"#000"});_.restore()}for(const h of a)Sbt({ctx:_,board:h,realToCanvasMat:o,soldermaskColor:l});for(const h of n)h.type==="pcb_trace"?QCo({ctx:_,trace:h,realToCanvasMat:o,soldermaskOverCopperColor:A,layer:r,vias:u,platedHoles:d}):h.type==="pcb_copper_pour"&&ECo({ctx:_,pour:h,realToCanvasMat:o,soldermaskOverCopperColor:A,layer:r,elements:n});for(const h of n)RCo({ctx:_,element:h,realToCanvasMat:o,soldermaskOverCopperColor:A,layer:r});_Co(e,_)}function RCo(t){const{ctx:e,element:n,realToCanvasMat:o,soldermaskOverCopperColor:i,layer:r}=t;if(n.type==="pcb_smtpad")BCo({ctx:e,pad:n,realToCanvasMat:o,soldermaskOverCopperColor:i,layer:r});else if(n.type==="pcb_plated_hole")PCo({ctx:e,hole:n,realToCanvasMat:o,soldermaskOverCopperColor:i,layer:r});else if(n.type==="pcb_hole")bCo({ctx:e,hole:n,realToCanvasMat:o,soldermaskOverCopperColor:i});else if(n.type==="pcb_via")TCo({ctx:e,via:n,realToCanvasMat:o});else if(n.type==="pcb_cutout")fCo({ctx:e,cutout:n,realToCanvasMat:o});else{if(n.type==="pcb_copper_pour")return;if(n.type==="pcb_trace")return}}function NCo(t,e){return e.copper[t]??e.copper.top}function Nbt(t){const{ctx:e,trace:n,realToCanvasMat:o,colorMap:i}=t;if(!n.route||!Array.isArray(n.route)||n.route.length<2)return;const r=TPe(n.route);for(const s of r){const a=s[0]?.layer;if(!a)continue;const c=NCo(a,i);if(Tbt(s)){const l=Bbt(s);cv({ctx:e,points:l,fill:c,realToCanvasMat:o});continue}for(let l=0;l<s.length-1;l++){const A=s[l],u=s[l+1];!A||!u||A.is_inside_copper_pour&&u.is_inside_copper_pour||VQ({ctx:e,start:{x:A.x,y:A.y},end:{x:u.x,y:u.y},strokeWidth:A.width,stroke:c,realToCanvasMat:o,lineCap:"round"})}}wbt({ctx:e,trace:n,realToCanvasMat:o,vias:t.vias??[],platedHoles:t.platedHoles??[]})}function kbt(t){const{ctx:e,via:n,realToCanvasMat:o,colorMap:i,layer:r}=t;z_({ctx:e,center:{x:n.x,y:n.y},radius:n.outer_diameter/2,fill:i.copper[r??"top"],realToCanvasMat:o}),e.save(),e.globalCompositeOperation="destination-out",z_({ctx:e,center:{x:n.x,y:n.y},radius:n.hole_diameter/2,fill:"#000",realToCanvasMat:o}),e.restore(),z_({ctx:e,center:{x:n.x,y:n.y},radius:n.hole_diameter/2,fill:i.drill,realToCanvasMat:o})}function iI(t,e){if(!e.layers||e.layers.length===0)return!0;const n=qle(t);return n.length===0?!0:n.some(o=>e.layers.includes(o))}var O1={copper:{top:"rgb(200, 52, 52)",inner1:"rgb(255, 140, 0)",inner2:"rgb(255, 215, 0)",inner3:"rgb(50, 205, 50)",inner4:"rgb(64, 224, 208)",inner5:"rgb(138, 43, 226)",inner6:"rgb(255, 105, 180)",bottom:"rgb(77, 127, 196)"},copperPour:{top:"rgb(230, 95, 95)",bottom:"rgb(122, 162, 222)"},soldermaskWithCopperUnderneath:{top:"rgb(18, 82, 50)",bottom:"rgb(77, 127, 196)"},soldermask:{top:"rgb(12, 55, 33)",bottom:"rgb(12, 55, 33)"},soldermaskOverCopper:{top:"rgb(52, 135, 73)",bottom:"rgb(52, 135, 73)"},substrate:"rgb(201, 162, 110)",drill:"#FF26E2",silkscreen:{top:"#f2eda1",bottom:"#5da9e9"},boardOutline:"rgba(255, 255, 255, 0.5)",courtyard:{top:"#FF00FF",bottom:"rgb(38, 233, 255)"},keepout:"#FF6B6B",fabricationNote:"rgba(255, 255, 255, 0.5)"};function kCo(t){return!t||t.length===0?"top":t.some(n=>n.startsWith("bottom"))?"bottom":"top"}var n_=class{ctx;colorMap;realToCanvasMat;constructor(t){if("getContext"in t&&typeof t.getContext=="function"){const e=t.getContext("2d");if(!e)throw new Error("Failed to get 2D rendering context from canvas");this.ctx=e}else this.ctx=t;this.colorMap={...O1},this.realToCanvasMat=syo()}configure(t){t.colorOverrides&&(this.colorMap={...this.colorMap,...t.colorOverrides,copper:{...this.colorMap.copper,...t.colorOverrides.copper},copperPour:{...this.colorMap.copperPour,...t.colorOverrides.copperPour},silkscreen:{...this.colorMap.silkscreen,...t.colorOverrides.silkscreen},soldermask:{...this.colorMap.soldermask,...t.colorOverrides.soldermask},soldermaskWithCopperUnderneath:{...this.colorMap.soldermaskWithCopperUnderneath,...t.colorOverrides.soldermaskWithCopperUnderneath},soldermaskOverCopper:{...this.colorMap.soldermaskOverCopper,...t.colorOverrides.soldermaskOverCopper}})}setCameraBounds(t){const e=this.ctx.canvas,n=e.width,o=e.height,i=t.maxX-t.minX,r=t.maxY-t.minY,s=n/i,a=o/r,c=Math.min(s,a),l=(n-i*c)/2,A=(o-r*c)/2;this.realToCanvasMat=vPe(av(l,A),lyo(c,-c),av(-t.minX,-t.maxY))}drawElements(t,e={}){const n=kCo(e.layers),o=t.find(d=>d.type==="pcb_board"),i=t.find(d=>d.type==="pcb_panel");i&&Xyo({ctx:this.ctx,panel:i,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap});const r=e.drawBoardMaterial??!1,s=e.drawSoldermask??!1,a=e.drawSoldermaskTop!==void 0||e.drawSoldermaskBottom!==void 0,c=s&&(o!==void 0||i!==void 0)&&(e.drawSoldermaskTop??!a),l=s&&(o!==void 0||i!==void 0)&&(e.drawSoldermaskBottom??!1),A=t.filter(d=>iI(d,e)&&d.type==="pcb_via"),u=t.filter(d=>iI(d,e)&&d.type==="pcb_plated_hole");o&&Ayo({ctx:this.ctx,board:o,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,drawBoardMaterial:r,minBoardOutlineStrokePx:e.minBoardOutlineStrokePx});for(const d of t)iI(d,e)&&d.type==="pcb_copper_pour"&&hyo({ctx:this.ctx,pour:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap});for(const d of t)iI(d,e)&&(d.type==="pcb_smtpad"&&dCo({ctx:this.ctx,pad:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_copper_text"&&byo({ctx:this.ctx,text:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));if(c){for(const d of t)iI(d,e)&&d.type==="pcb_trace"&&Nbt({ctx:this.ctx,trace:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,vias:A,platedHoles:u});for(const d of t)iI(d,e)&&(d.type==="pcb_hole"&&Ibt({ctx:this.ctx,hole:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,soldermaskMargin:d.soldermask_margin,drawSoldermask:c}),d.type==="pcb_plated_hole"&&Ebt({ctx:this.ctx,hole:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,soldermaskMargin:d.soldermask_margin,drawSoldermask:c,layer:n}),d.type==="pcb_via"&&kbt({ctx:this.ctx,via:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,layer:n}))}c&&Rbt({ctx:this.ctx,elements:t,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,layer:"top",drawSoldermask:!0});for(const d of t)iI(d,e)&&(d.type==="pcb_silkscreen_text"&&ACo({ctx:this.ctx,text:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_silkscreen_rect"&&aCo({ctx:this.ctx,rect:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_silkscreen_circle"&&qyo({ctx:this.ctx,circle:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_silkscreen_line"&&Zyo({ctx:this.ctx,line:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_silkscreen_path"&&oCo({ctx:this.ctx,path:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_silkscreen_pill"&&rCo({ctx:this.ctx,pill:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_silkscreen_oval"&&tCo({ctx:this.ctx,oval:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}));for(const d of t)iI(d,e)&&d.type==="pcb_trace"&&!c&&Nbt({ctx:this.ctx,trace:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,vias:A,platedHoles:u});for(const d of t)iI(d,e)&&d.type==="pcb_hole"&&!c&&Ibt({ctx:this.ctx,hole:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,soldermaskMargin:c?d.soldermask_margin:void 0,drawSoldermask:c});for(const d of t)iI(d,e)&&(d.type==="pcb_plated_hole"&&!c&&Ebt({ctx:this.ctx,hole:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,soldermaskMargin:c?d.soldermask_margin:void 0,drawSoldermask:c,layer:n}),d.type==="pcb_via"&&!c&&kbt({ctx:this.ctx,via:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,layer:n}));l&&Rbt({ctx:this.ctx,elements:t,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,layer:"bottom",drawSoldermask:!0});for(const d of t)iI(d,e)&&d.type==="pcb_cutout"&&Dyo({ctx:this.ctx,cutout:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap});for(const d of t){if(!iI(d,e))continue;d.type==="pcb_keepout"&&Gyo({ctx:this.ctx,keepout:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_fabrication_note_text"&&Fyo({ctx:this.ctx,text:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_fabrication_note_rect"&&Hyo({ctx:this.ctx,rect:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap});const _=e.showPcbNotes??!0;_&&d.type==="pcb_note_rect"&&Kyo({realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap,ctx:this.ctx,rect:d}),d.type==="pcb_fabrication_note_path"&&kyo({ctx:this.ctx,path:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),_&&d.type==="pcb_note_path"&&Yyo({ctx:this.ctx,path:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),_&&d.type==="pcb_note_text"&&jyo({ctx:this.ctx,text:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),_&&d.type==="pcb_note_line"&&Vyo({ctx:this.ctx,line:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),_&&d.type==="pcb_note_dimension"&&zyo({ctx:this.ctx,pcbNoteDimension:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_fabrication_note_dimension"&&Nyo({ctx:this.ctx,pcbFabricationNoteDimension:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_courtyard_circle"&&Pyo({ctx:this.ctx,circle:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_courtyard_rect"&&wyo({ctx:this.ctx,rect:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap}),d.type==="pcb_courtyard_outline"&&Byo({ctx:this.ctx,outline:d,realToCanvasMat:this.realToCanvasMat,colorMap:this.colorMap})}}};const HCo=t9t(_Rt);var RPe,Hbt;function LCo(){if(Hbt)return RPe;Hbt=1;var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i=(p,g)=>{for(var f in g)t(p,f,{get:g[f],enumerable:!0})},r=(p,g,f,y)=>{if(g&&typeof g=="object"||typeof g=="function")for(let C of n(g))!o.call(p,C)&&C!==f&&t(p,C,{get:()=>g[C],enumerable:!(y=e(g,C))||y.enumerable});return p},s=p=>r(t({},"__esModule",{value:!0}),p),a={};i(a,{SuperGrid:()=>m,toMMSI:()=>h,toMeterSI:()=>_}),RPe=s(a);var c=WC(),l=HCo,A=PBe(),u=(p,g,f)=>{const y=[];if(g<p)for(let C=p;C>=g;C-=Math.abs(f))y.push(C);else for(let C=p;C<=g;C+=Math.abs(f))y.push(C);return y};function d(p,g){return{x:Math.round(g.x/p)*p,y:Math.round(g.y/p)*p}}function _(p,g=1){return p<0?"-"+_(-p):p<1e-6?"0m":p>1e3?Math.floor(p/1e3)+"km":p>1&&g>1?Math.round(p)+"m":p>1&&g<=1?p.toFixed(Math.ceil(-Math.log10(g)))+"m":p<1&&g>=1/1e3?Math.round(p*1e3)+"mm":p<1&&g<1/1e3?(p*1e3).toFixed(Math.ceil(-Math.log10(g*1e3)))+"mm":""}function h(p,g=1){return _(p/1e3,g/1e3)}var m=p=>{var g;const f=(0,c.useRef)(null),[y,C]=(0,c.useState)({x:0,y:0}),{majorColor:I="rgba(0,0,0,0.2)",minorColor:E="rgba(0,0,0,0.1)",textColor:b=(g=p.majorColor)!=null?g:"rgba(0,0,0,0.5)",width:P,height:B,screenSpaceCellSize:M=200,stringifyCoord:k=(G,W,j)=>`${_(G,j)}, ${_(W,j)}`}=p,N=Math.ceil(P/M)+2,L=Math.ceil(B/M)+2;(0,c.useEffect)(()=>{if(!f.current)return;const G=f.current.getContext("2d");if(!G)return;const W=M/10**Math.floor(Math.log10(p.transform.a)),j=p.transform.d<0?-1:1,oe=M/10**Math.log10(p.transform.a)/W;function le(Pe,de,Te){const Ge=Pe;let Ye,fe,Xe;for(Ye=de.x;Ye<=Te.x;Ye+=Ge)fe=(0,l.applyToPoint)(p.transform,{x:Ye,y:de.y}),Xe=(0,l.applyToPoint)(p.transform,{x:Ye,y:Te.y}),G.beginPath(),G.moveTo(fe.x,fe.y),G.lineTo(Xe.x,Xe.y),G.stroke();const Fe=u(de.y,Te.y,Ge*j);for(const we of Fe)fe=(0,l.applyToPoint)(p.transform,{x:de.x,y:we}),Xe=(0,l.applyToPoint)(p.transform,{x:Te.x,y:we}),G.beginPath(),G.moveTo(fe.x,fe.y),G.lineTo(Xe.x,Xe.y),G.stroke()}function ee(Pe,de,Te){const Ge=Pe;let Ye;for(Ye=de.x;Ye<=Te.x;Ye+=Ge)for(const fe of u(de.y,Te.y,Ge*j)){const Xe=(0,l.applyToPoint)(p.transform,{x:Ye,y:fe});G.fillStyle=b,G.font="12px sans-serif",G.fillText(k(Ye,fe,Pe),Xe.x+2,Xe.y-2)}}G.clearRect(0,0,P,B);const ie=(0,l.applyToPoint)((0,l.inverse)(p.transform),{x:0,y:0}),ae={x:Math.floor((ie.x-W)/W)*W,y:Math.floor((ie.y-W)/W+(j==-1?2:0))*W},re={x:ae.x+W*N,y:ae.y+W*L*j},ye=W*5,be={x:Math.floor((ie.x-ye)/ye)*ye,y:Math.floor((ie.y-ye)/ye+(j==-1?2:0))*ye},ve={x:be.x+ye*N,y:be.y+ye*L*j};G.globalAlpha=1,G.strokeStyle=I,le(W,ae,re),ee(ye,be,ve),G.globalAlpha=1-oe,le(ye/10,be,ve),G.globalAlpha=1-oe,G.strokeStyle=E,le(W/10,ae,re),G.globalAlpha=Math.max(((1-oe)*10-5)/5,0),ee(ye/10,be,ve),G.globalAlpha=1;const he=(0,l.applyToPoint)(p.transform,y);G.font="12px sans-serif",G.fillStyle=b,G.fillText(k(y.x,y.y,W),he.x+2,he.y-2),G.strokeStyle=I,G.strokeRect(he.x-5,he.y-5,10,10)},[f,p.transform,y,P,B]);const F=G=>{if(!f.current)return;const W=M/10/10**Math.floor(Math.log10(p.transform.a)),j=f.current.getBoundingClientRect(),$=(0,l.applyToPoint)((0,l.inverse)(p.transform),{x:G.clientX-j.left,y:G.clientY-j.top}),oe=d(W,$);C(oe)};return(0,A.jsx)("canvas",{onMouseUp:G=>{G.button===1&&F(G)},onDoubleClick:F,ref:f,width:p.width,height:p.height})};return RPe}var Gee=LCo();function FCo(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}function OCo(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),t.nonce!==void 0&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var GCo=(function(){function t(n){var o=this;this._insertTag=function(i){var r;o.tags.length===0?o.insertionPoint?r=o.insertionPoint.nextSibling:o.prepend?r=o.container.firstChild:r=o.before:r=o.tags[o.tags.length-1].nextSibling,o.container.insertBefore(i,r),o.tags.push(i)},this.isSpeedy=n.speedy===void 0?!0:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(o){o.forEach(this._insertTag)},e.insert=function(o){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(OCo(this));var i=this.tags[this.tags.length-1];if(this.isSpeedy){var r=FCo(i);try{r.insertRule(o,r.cssRules.length)}catch{}}else i.appendChild(document.createTextNode(o));this.ctr++},e.flush=function(){this.tags.forEach(function(o){var i;return(i=o.parentNode)==null?void 0:i.removeChild(o)}),this.tags=[],this.ctr=0},t})(),Nf="-ms-",Uee="-moz-",Dl="-webkit-",Lbt="comm",NPe="rule",kPe="decl",UCo="@import",Fbt="@keyframes",zCo="@layer",VCo=Math.abs,zee=String.fromCharCode,YCo=Object.assign;function KCo(t,e){return Ep(t,0)^45?(((e<<2^Ep(t,0))<<2^Ep(t,1))<<2^Ep(t,2))<<2^Ep(t,3):0}function Obt(t){return t.trim()}function WCo(t,e){return(t=e.exec(t))?t[0]:t}function Ql(t,e,n){return t.replace(e,n)}function HPe(t,e){return t.indexOf(e)}function Ep(t,e){return t.charCodeAt(e)|0}function mO(t,e,n){return t.slice(e,n)}function sE(t){return t.length}function LPe(t){return t.length}function Vee(t,e){return e.push(t),t}function jCo(t,e){return t.map(e).join("")}var Yee=1,KQ=1,Gbt=0,dC=0,V_=0,WQ="";function Kee(t,e,n,o,i,r,s){return{value:t,root:e,parent:n,type:o,props:i,children:r,line:Yee,column:KQ,length:s,return:""}}function gO(t,e){return YCo(Kee("",null,null,"",null,null,0),t,{length:-t.length},e)}function XCo(){return V_}function JCo(){return V_=dC>0?Ep(WQ,--dC):0,KQ--,V_===10&&(KQ=1,Yee--),V_}function Tx(){return V_=dC<Gbt?Ep(WQ,dC++):0,KQ++,V_===10&&(KQ=1,Yee++),V_}function aE(){return Ep(WQ,dC)}function Wee(){return dC}function pO(t,e){return mO(WQ,t,e)}function fO(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Ubt(t){return Yee=KQ=1,Gbt=sE(WQ=t),dC=0,[]}function zbt(t){return WQ="",t}function jee(t){return Obt(pO(dC-1,FPe(t===91?t+2:t===40?t+1:t)))}function qCo(t){for(;(V_=aE())&&V_<33;)Tx();return fO(t)>2||fO(V_)>3?"":" "}function $Co(t,e){for(;--e&&Tx()&&!(V_<48||V_>102||V_>57&&V_<65||V_>70&&V_<97););return pO(t,Wee()+(e<6&&aE()==32&&Tx()==32))}function FPe(t){for(;Tx();)switch(V_){case t:return dC;case 34:case 39:t!==34&&t!==39&&FPe(V_);break;case 40:t===41&&FPe(t);break;case 92:Tx();break}return dC}function ZCo(t,e){for(;Tx()&&t+V_!==57;)if(t+V_===84&&aE()===47)break;return"/*"+pO(e,dC-1)+"*"+zee(t===47?t:Tx())}function exo(t){for(;!fO(aE());)Tx();return pO(t,dC)}function txo(t){return zbt(Xee("",null,null,null,[""],t=Ubt(t),0,[0],t))}function Xee(t,e,n,o,i,r,s,a,c){for(var l=0,A=0,u=s,d=0,_=0,h=0,m=1,p=1,g=1,f=0,y="",C=i,I=r,E=o,b=y;p;)switch(h=f,f=Tx()){case 40:if(h!=108&&Ep(b,u-1)==58){HPe(b+=Ql(jee(f),"&","&\f"),"&\f")!=-1&&(g=-1);break}case 34:case 39:case 91:b+=jee(f);break;case 9:case 10:case 13:case 32:b+=qCo(h);break;case 92:b+=$Co(Wee()-1,7);continue;case 47:switch(aE()){case 42:case 47:Vee(nxo(ZCo(Tx(),Wee()),e,n),c);break;default:b+="/"}break;case 123*m:a[l++]=sE(b)*g;case 125*m:case 59:case 0:switch(f){case 0:case 125:p=0;case 59+A:g==-1&&(b=Ql(b,/\f/g,"")),_>0&&sE(b)-u&&Vee(_>32?Ybt(b+";",o,n,u-1):Ybt(Ql(b," ","")+";",o,n,u-2),c);break;case 59:b+=";";default:if(Vee(E=Vbt(b,e,n,l,A,i,a,y,C=[],I=[],u),r),f===123)if(A===0)Xee(b,e,E,E,C,r,u,a,I);else switch(d===99&&Ep(b,3)===110?100:d){case 100:case 108:case 109:case 115:Xee(t,E,E,o&&Vee(Vbt(t,E,E,0,0,i,a,y,i,C=[],u),I),i,I,u,a,o?C:I);break;default:Xee(b,E,E,E,[""],I,0,a,I)}}l=A=_=0,m=g=1,y=b="",u=s;break;case 58:u=1+sE(b),_=h;default:if(m<1){if(f==123)--m;else if(f==125&&m++==0&&JCo()==125)continue}switch(b+=zee(f),f*m){case 38:g=A>0?1:(b+="\f",-1);break;case 44:a[l++]=(sE(b)-1)*g,g=1;break;case 64:aE()===45&&(b+=jee(Tx())),d=aE(),A=u=sE(y=b+=exo(Wee())),f++;break;case 45:h===45&&sE(b)==2&&(m=0)}}return r}function Vbt(t,e,n,o,i,r,s,a,c,l,A){for(var u=i-1,d=i===0?r:[""],_=LPe(d),h=0,m=0,p=0;h<o;++h)for(var g=0,f=mO(t,u+1,u=VCo(m=s[h])),y=t;g<_;++g)(y=Obt(m>0?d[g]+" "+f:Ql(f,/&\f/g,d[g])))&&(c[p++]=y);return Kee(t,e,n,i===0?NPe:a,c,l,A)}function nxo(t,e,n){return Kee(t,e,n,Lbt,zee(XCo()),mO(t,2,-2),0)}function Ybt(t,e,n,o){return Kee(t,e,n,kPe,mO(t,0,o),mO(t,o+1,-1),o)}function jQ(t,e){for(var n="",o=LPe(t),i=0;i<o;i++)n+=e(t[i],i,t,e)||"";return n}function oxo(t,e,n,o){switch(t.type){case zCo:if(t.children.length)break;case UCo:case kPe:return t.return=t.return||t.value;case Lbt:return"";case Fbt:return t.return=t.value+"{"+jQ(t.children,o)+"}";case NPe:t.value=t.props.join(",")}return sE(n=jQ(t.children,o))?t.return=t.value+"{"+n+"}":""}function ixo(t){var e=LPe(t);return function(n,o,i,r){for(var s="",a=0;a<e;a++)s+=t[a](n,o,i,r)||"";return s}}function rxo(t){return function(e){e.root||(e=e.return)&&t(e)}}function sxo(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var axo=function(e,n,o){for(var i=0,r=0;i=r,r=aE(),i===38&&r===12&&(n[o]=1),!fO(r);)Tx();return pO(e,dC)},cxo=function(e,n){var o=-1,i=44;do switch(fO(i)){case 0:i===38&&aE()===12&&(n[o]=1),e[o]+=axo(dC-1,n,o);break;case 2:e[o]+=jee(i);break;case 4:if(i===44){e[++o]=aE()===58?"&\f":"",n[o]=e[o].length;break}default:e[o]+=zee(i)}while(i=Tx());return e},lxo=function(e,n){return zbt(cxo(Ubt(e),n))},Kbt=new WeakMap,Axo=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var n=e.value,o=e.parent,i=e.column===o.column&&e.line===o.line;o.type!=="rule";)if(o=o.parent,!o)return;if(!(e.props.length===1&&n.charCodeAt(0)!==58&&!Kbt.get(o))&&!i){Kbt.set(e,!0);for(var r=[],s=lxo(n,r),a=o.props,c=0,l=0;c<s.length;c++)for(var A=0;A<a.length;A++,l++)e.props[l]=r[c]?s[c].replace(/&\f/g,a[A]):a[A]+" "+s[c]}}},uxo=function(e){if(e.type==="decl"){var n=e.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(e.return="",e.value="")}};function Wbt(t,e){switch(KCo(t,e)){case 5103:return Dl+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Dl+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return Dl+t+Uee+t+Nf+t+t;case 6828:case 4268:return Dl+t+Nf+t+t;case 6165:return Dl+t+Nf+"flex-"+t+t;case 5187:return Dl+t+Ql(t,/(\w+).+(:[^]+)/,Dl+"box-$1$2"+Nf+"flex-$1$2")+t;case 5443:return Dl+t+Nf+"flex-item-"+Ql(t,/flex-|-self/,"")+t;case 4675:return Dl+t+Nf+"flex-line-pack"+Ql(t,/align-content|flex-|-self/,"")+t;case 5548:return Dl+t+Nf+Ql(t,"shrink","negative")+t;case 5292:return Dl+t+Nf+Ql(t,"basis","preferred-size")+t;case 6060:return Dl+"box-"+Ql(t,"-grow","")+Dl+t+Nf+Ql(t,"grow","positive")+t;case 4554:return Dl+Ql(t,/([^-])(transform)/g,"$1"+Dl+"$2")+t;case 6187:return Ql(Ql(Ql(t,/(zoom-|grab)/,Dl+"$1"),/(image-set)/,Dl+"$1"),t,"")+t;case 5495:case 3959:return Ql(t,/(image-set\([^]*)/,Dl+"$1$`$1");case 4968:return Ql(Ql(t,/(.+:)(flex-)?(.*)/,Dl+"box-pack:$3"+Nf+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Dl+t+t;case 4095:case 3583:case 4068:case 2532:return Ql(t,/(.+)-inline(.+)/,Dl+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(sE(t)-1-e>6)switch(Ep(t,e+1)){case 109:if(Ep(t,e+4)!==45)break;case 102:return Ql(t,/(.+:)(.+)-([^]+)/,"$1"+Dl+"$2-$3$1"+Uee+(Ep(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~HPe(t,"stretch")?Wbt(Ql(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(Ep(t,e+1)!==115)break;case 6444:switch(Ep(t,sE(t)-3-(~HPe(t,"!important")&&10))){case 107:return Ql(t,":",":"+Dl)+t;case 101:return Ql(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Dl+(Ep(t,14)===45?"inline-":"")+"box$3$1"+Dl+"$2$3$1"+Nf+"$2box$3")+t}break;case 5936:switch(Ep(t,e+11)){case 114:return Dl+t+Nf+Ql(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return Dl+t+Nf+Ql(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return Dl+t+Nf+Ql(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return Dl+t+Nf+t+t}return t}var dxo=function(e,n,o,i){if(e.length>-1&&!e.return)switch(e.type){case kPe:e.return=Wbt(e.value,e.length);break;case Fbt:return jQ([gO(e,{value:Ql(e.value,"@","@"+Dl)})],i);case NPe:if(e.length)return jCo(e.props,function(r){switch(WCo(r,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return jQ([gO(e,{props:[Ql(r,/:(read-\w+)/,":"+Uee+"$1")]})],i);case"::placeholder":return jQ([gO(e,{props:[Ql(r,/:(plac\w+)/,":"+Dl+"input-$1")]}),gO(e,{props:[Ql(r,/:(plac\w+)/,":"+Uee+"$1")]}),gO(e,{props:[Ql(r,/:(plac\w+)/,Nf+"input-$1")]})],i)}return""})}},hxo=[dxo],_xo=function(e){var n=e.key;if(n==="css"){var o=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(o,function(m){var p=m.getAttribute("data-emotion");p.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=e.stylisPlugins||hxo,r={},s,a=[];s=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var p=m.getAttribute("data-emotion").split(" "),g=1;g<p.length;g++)r[p[g]]=!0;a.push(m)});var c,l=[Axo,uxo];{var A,u=[oxo,rxo(function(m){A.insert(m)})],d=ixo(l.concat(i,u)),_=function(p){return jQ(txo(p),d)};c=function(p,g,f,y){A=f,_(p?p+"{"+g.styles+"}":g.styles),y&&(h.inserted[g.name]=!0)}}var h={key:n,sheet:new GCo({key:n,container:s,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:r,registered:{},insert:c};return h.sheet.hydrate(a),h};function mxo(t){for(var e=0,n,o=0,i=t.length;i>=4;++o,i-=4)n=t.charCodeAt(o)&255|(t.charCodeAt(++o)&255)<<8|(t.charCodeAt(++o)&255)<<16|(t.charCodeAt(++o)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(i){case 3:e^=(t.charCodeAt(o+2)&255)<<16;case 2:e^=(t.charCodeAt(o+1)&255)<<8;case 1:e^=t.charCodeAt(o)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var gxo={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},pxo=/[A-Z]|^ms/g,fxo=/_EMO_([^_]+?)_([^]*?)_EMO_/g,jbt=function(e){return e.charCodeAt(1)===45},Xbt=function(e){return e!=null&&typeof e!="boolean"},OPe=sxo(function(t){return jbt(t)?t:t.replace(pxo,"-$&").toLowerCase()}),Jbt=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(fxo,function(o,i,r){return Av={name:i,styles:r,next:Av},i})}return gxo[e]!==1&&!jbt(e)&&typeof n=="number"&&n!==0?n+"px":n};function Jee(t,e,n){if(n==null)return"";var o=n;if(o.__emotion_styles!==void 0)return o;switch(typeof n){case"boolean":return"";case"object":{var i=n;if(i.anim===1)return Av={name:i.name,styles:i.styles,next:Av},i.name;var r=n;if(r.styles!==void 0){var s=r.next;if(s!==void 0)for(;s!==void 0;)Av={name:s.name,styles:s.styles,next:Av},s=s.next;var a=r.styles+";";return a}return yxo(t,e,n)}}var c=n;if(e==null)return c;var l=e[c];return l!==void 0?l:c}function yxo(t,e,n){var o="";if(Array.isArray(n))for(var i=0;i<n.length;i++)o+=Jee(t,e,n[i])+";";else for(var r in n){var s=n[r];if(typeof s!="object"){var a=s;e!=null&&e[a]!==void 0?o+=r+"{"+e[a]+"}":Xbt(a)&&(o+=OPe(r)+":"+Jbt(r,a)+";")}else if(Array.isArray(s)&&typeof s[0]=="string"&&(e==null||e[s[0]]===void 0))for(var c=0;c<s.length;c++)Xbt(s[c])&&(o+=OPe(r)+":"+Jbt(r,s[c])+";");else{var l=Jee(t,e,s);switch(r){case"animation":case"animationName":{o+=OPe(r)+":"+l+";";break}default:o+=r+"{"+l+"}"}}}return o}var qbt=/label:\s*([^\s;{]+)\s*(;|$)/g,Av;function GPe(t,e,n){if(t.length===1&&typeof t[0]=="object"&&t[0]!==null&&t[0].styles!==void 0)return t[0];var o=!0,i="";Av=void 0;var r=t[0];if(r==null||r.raw===void 0)o=!1,i+=Jee(n,e,r);else{var s=r;i+=s[0]}for(var a=1;a<t.length;a++)if(i+=Jee(n,e,t[a]),o){var c=r;i+=c[a]}qbt.lastIndex=0;for(var l="",A;(A=qbt.exec(i))!==null;)l+="-"+A[1];var u=mxo(i)+l;return{name:u,styles:i,next:Av}}function $bt(t,e,n){var o="";return n.split(" ").forEach(function(i){t[i]!==void 0?e.push(t[i]+";"):i&&(o+=i+" ")}),o}var Cxo=function(e,n,o){var i=e.key+"-"+n.name;e.registered[i]===void 0&&(e.registered[i]=n.styles)},xxo=function(e,n,o){Cxo(e,n);var i=e.key+"-"+n.name;if(e.inserted[n.name]===void 0){var r=n;do e.insert(n===r?"."+i:"",r,e.sheet,!0),r=r.next;while(r!==void 0)}};function Zbt(t,e){if(t.inserted[e.name]===void 0)return t.insert("",e,t.sheet,!0)}function eSt(t,e,n){var o=[],i=$bt(t,o,n);return o.length<2?n:i+e(o)}var Ixo=function(e){var n=_xo(e);n.sheet.speedy=function(a){this.isSpeedy=a},n.compat=!0;var o=function(){for(var c=arguments.length,l=new Array(c),A=0;A<c;A++)l[A]=arguments[A];var u=GPe(l,n.registered,void 0);return xxo(n,u),n.key+"-"+u.name},i=function(){for(var c=arguments.length,l=new Array(c),A=0;A<c;A++)l[A]=arguments[A];var u=GPe(l,n.registered),d="animation-"+u.name;return Zbt(n,{name:u.name,styles:"@keyframes "+d+"{"+u.styles+"}"}),d},r=function(){for(var c=arguments.length,l=new Array(c),A=0;A<c;A++)l[A]=arguments[A];var u=GPe(l,n.registered);Zbt(n,u)},s=function(){for(var c=arguments.length,l=new Array(c),A=0;A<c;A++)l[A]=arguments[A];return eSt(n.registered,o,Exo(l))};return{css:o,cx:s,injectGlobal:r,keyframes:i,hydrate:function(c){c.forEach(function(l){n.inserted[l]=!0})},flush:function(){n.registered={},n.inserted={},n.sheet.flush()},sheet:n.sheet,cache:n,getRegisteredStyles:$bt.bind(null,n.registered),merge:eSt.bind(null,n.registered,o)}},Exo=function t(e){for(var n="",o=0;o<e.length;o++){var i=e[o];if(i!=null){var r=void 0;switch(typeof i){case"boolean":break;case"object":{if(Array.isArray(i))r=t(i);else{r="";for(var s in i)i[s]&&s&&(r&&(r+=" "),r+=s)}break}default:r=i}r&&(n&&(n+=" "),n+=r)}}return n},bxo=Ixo({key:"css"}),XQ=bxo.css,Sxo=Object.create,tSt=Object.defineProperty,Pxo=Object.getOwnPropertyDescriptor,nSt=Object.getOwnPropertyNames,vxo=Object.getPrototypeOf,Bxo=Object.prototype.hasOwnProperty,Wc=(t,e)=>function(){return e||(0,t[nSt(t)[0]])((e={exports:{}}).exports,e),e.exports},Mxo=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of nSt(e))!Bxo.call(t,i)&&i!==n&&tSt(t,i,{get:()=>e[i],enumerable:!(o=Pxo(e,i))||o.enumerable});return t},UPe=(t,e,n)=>(n=t!=null?Sxo(vxo(t)):{},Mxo(e||!t||!t.__esModule?tSt(n,"default",{value:t,enumerable:!0}):n,t)),wxo=Wc({"node_modules/toggle-selection/index.js"(t,e){e.exports=function(){var n=document.getSelection();if(!n.rangeCount)return function(){};for(var o=document.activeElement,i=[],r=0;r<n.rangeCount;r++)i.push(n.getRangeAt(r));switch(o.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":o.blur();break;default:o=null;break}return n.removeAllRanges(),function(){n.type==="Caret"&&n.removeAllRanges(),n.rangeCount||i.forEach(function(s){n.addRange(s)}),o&&o.focus()}}}}),Dxo=Wc({"node_modules/copy-to-clipboard/index.js"(t,e){var n=wxo(),o={"text/plain":"Text","text/html":"Url",default:"Text"},i="Copy to clipboard: #{key}, Enter";function r(a){var c=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return a.replace(/#{\s*key\s*}/g,c)}function s(a,c){var l,A,u,d,_,h,m=!1;c||(c={}),l=c.debug||!1;try{u=n(),d=document.createRange(),_=document.getSelection(),h=document.createElement("span"),h.textContent=a,h.ariaHidden="true",h.style.all="unset",h.style.position="fixed",h.style.top=0,h.style.clip="rect(0, 0, 0, 0)",h.style.whiteSpace="pre",h.style.webkitUserSelect="text",h.style.MozUserSelect="text",h.style.msUserSelect="text",h.style.userSelect="text",h.addEventListener("copy",function(g){if(g.stopPropagation(),c.format)if(g.preventDefault(),typeof g.clipboardData>"u"){l&&console.warn("unable to use e.clipboardData"),l&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=o[c.format]||o.default;window.clipboardData.setData(f,a)}else g.clipboardData.clearData(),g.clipboardData.setData(c.format,a);c.onCopy&&(g.preventDefault(),c.onCopy(g.clipboardData))}),document.body.appendChild(h),d.selectNodeContents(h),_.addRange(d);var p=document.execCommand("copy");if(!p)throw new Error("copy command was unsuccessful");m=!0}catch(g){l&&console.error("unable to copy using execCommand: ",g),l&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(c.format||"text",a),c.onCopy&&c.onCopy(window.clipboardData),m=!0}catch(f){l&&console.error("unable to copy using clipboardData: ",f),l&&console.error("falling back to prompt"),A=r("message"in c?c.message:i),window.prompt(A,a)}}finally{_&&(typeof _.removeRange=="function"?_.removeRange(d):_.removeAllRanges()),h&&document.body.removeChild(h),u()}return m}e.exports=s}}),Qxo=Wc({"node_modules/svgson/dist/svgson.umd.js"(t,e){(function(n,o){typeof t=="object"&&typeof e<"u"?e.exports=o():typeof define=="function"&&define.amd?define(o):(n=typeof globalThis<"u"?globalThis:n||self,n.svgson=o())})(t,function(){var n=function(ee){return ee!=null&&(o(ee)||i(ee)||!!ee._isBuffer)};function o(ee){return!!ee.constructor&&typeof ee.constructor.isBuffer=="function"&&ee.constructor.isBuffer(ee)}function i(ee){return typeof ee.readFloatLE=="function"&&typeof ee.slice=="function"&&o(ee.slice(0,0))}var r=Object.prototype.toString,s=function(ie){if(typeof ie>"u")return"undefined";if(ie===null)return"null";if(ie===!0||ie===!1||ie instanceof Boolean)return"boolean";if(typeof ie=="string"||ie instanceof String)return"string";if(typeof ie=="number"||ie instanceof Number)return"number";if(typeof ie=="function"||ie instanceof Function)return"function";if(typeof Array.isArray<"u"&&Array.isArray(ie))return"array";if(ie instanceof RegExp)return"regexp";if(ie instanceof Date)return"date";var ae=r.call(ie);return ae==="[object RegExp]"?"regexp":ae==="[object Date]"?"date":ae==="[object Arguments]"?"arguments":ae==="[object Error]"?"error":n(ie)?"buffer":ae==="[object Set]"?"set":ae==="[object WeakSet]"?"weakset":ae==="[object Map]"?"map":ae==="[object WeakMap]"?"weakmap":ae==="[object Symbol]"?"symbol":ae==="[object Int8Array]"?"int8array":ae==="[object Uint8Array]"?"uint8array":ae==="[object Uint8ClampedArray]"?"uint8clampedarray":ae==="[object Int16Array]"?"int16array":ae==="[object Uint16Array]"?"uint16array":ae==="[object Int32Array]"?"int32array":ae==="[object Uint32Array]"?"uint32array":ae==="[object Float32Array]"?"float32array":ae==="[object Float64Array]"?"float64array":"object"};function a(ee,ie){return ie={exports:{}},ee(ie,ie.exports),ie.exports}var c=a(function(ee){(function(){function ie(ae,re){if(typeof re!="function")return ae;var ue={};for(var ye in ae)Object.prototype.hasOwnProperty.call(ae,ye)&&(ue[re(ye,ae[ye])||ye]=ae[ye]);return ue}ee.exports?ee.exports=ie:window.rename=ie})()}),l=function ee(ie,ae){var re=s(ie);if(re!=="object"&&re!=="array")throw new Error("expected an object");var ue=[];re==="object"&&(ie=c(ie,ae),ue={});for(var ye in ie)if(ie.hasOwnProperty(ye)){var be=ie[ye];s(be)==="object"||s(be)==="array"?ue[ye]=ee(be,ae):ue[ye]=be}return ue},A=a(function(ee){var ie=Object.prototype.hasOwnProperty,ae="~";function re(){}Object.create&&(re.prototype=Object.create(null),new re().__proto__||(ae=!1));function ue(be,ve,he){this.fn=be,this.context=ve,this.once=he||!1}function ye(){this._events=new re,this._eventsCount=0}ye.prototype.eventNames=function(){var ve=[],he,Pe;if(this._eventsCount===0)return ve;for(Pe in he=this._events)ie.call(he,Pe)&&ve.push(ae?Pe.slice(1):Pe);return Object.getOwnPropertySymbols?ve.concat(Object.getOwnPropertySymbols(he)):ve},ye.prototype.listeners=function(ve,he){var Pe=ae?ae+ve:ve,de=this._events[Pe];if(he)return!!de;if(!de)return[];if(de.fn)return[de.fn];for(var Te=0,Ge=de.length,Ye=new Array(Ge);Te<Ge;Te++)Ye[Te]=de[Te].fn;return Ye},ye.prototype.emit=function(ve,he,Pe,de,Te,Ge){var Ye=ae?ae+ve:ve;if(!this._events[Ye])return!1;var fe=this._events[Ye],Xe=arguments.length,Fe,we;if(fe.fn){switch(fe.once&&this.removeListener(ve,fe.fn,void 0,!0),Xe){case 1:return fe.fn.call(fe.context),!0;case 2:return fe.fn.call(fe.context,he),!0;case 3:return fe.fn.call(fe.context,he,Pe),!0;case 4:return fe.fn.call(fe.context,he,Pe,de),!0;case 5:return fe.fn.call(fe.context,he,Pe,de,Te),!0;case 6:return fe.fn.call(fe.context,he,Pe,de,Te,Ge),!0}for(we=1,Fe=new Array(Xe-1);we<Xe;we++)Fe[we-1]=arguments[we];fe.fn.apply(fe.context,Fe)}else{var Ue=fe.length,De;for(we=0;we<Ue;we++)switch(fe[we].once&&this.removeListener(ve,fe[we].fn,void 0,!0),Xe){case 1:fe[we].fn.call(fe[we].context);break;case 2:fe[we].fn.call(fe[we].context,he);break;case 3:fe[we].fn.call(fe[we].context,he,Pe);break;case 4:fe[we].fn.call(fe[we].context,he,Pe,de);break;default:if(!Fe)for(De=1,Fe=new Array(Xe-1);De<Xe;De++)Fe[De-1]=arguments[De];fe[we].fn.apply(fe[we].context,Fe)}}return!0},ye.prototype.on=function(ve,he,Pe){var de=new ue(he,Pe||this),Te=ae?ae+ve:ve;return this._events[Te]?this._events[Te].fn?this._events[Te]=[this._events[Te],de]:this._events[Te].push(de):(this._events[Te]=de,this._eventsCount++),this},ye.prototype.once=function(ve,he,Pe){var de=new ue(he,Pe||this,!0),Te=ae?ae+ve:ve;return this._events[Te]?this._events[Te].fn?this._events[Te]=[this._events[Te],de]:this._events[Te].push(de):(this._events[Te]=de,this._eventsCount++),this},ye.prototype.removeListener=function(ve,he,Pe,de){var Te=ae?ae+ve:ve;if(!this._events[Te])return this;if(!he)return--this._eventsCount===0?this._events=new re:delete this._events[Te],this;var Ge=this._events[Te];if(Ge.fn)Ge.fn===he&&(!de||Ge.once)&&(!Pe||Ge.context===Pe)&&(--this._eventsCount===0?this._events=new re:delete this._events[Te]);else{for(var Ye=0,fe=[],Xe=Ge.length;Ye<Xe;Ye++)(Ge[Ye].fn!==he||de&&!Ge[Ye].once||Pe&&Ge[Ye].context!==Pe)&&fe.push(Ge[Ye]);fe.length?this._events[Te]=fe.length===1?fe[0]:fe:--this._eventsCount===0?this._events=new re:delete this._events[Te]}return this},ye.prototype.removeAllListeners=function(ve){var he;return ve?(he=ae?ae+ve:ve,this._events[he]&&(--this._eventsCount===0?this._events=new re:delete this._events[he])):(this._events=new re,this._eventsCount=0),this},ye.prototype.off=ye.prototype.removeListener,ye.prototype.addListener=ye.prototype.on,ye.prototype.setMaxListeners=function(){return this},ye.prefixed=ae,ye.EventEmitter=ye,ee.exports=ye});function u(ee,ie,ae){return ie in ee?Object.defineProperty(ee,ie,{value:ae,enumerable:!0,configurable:!0,writable:!0}):ee[ie]=ae,ee}var d=function(){},_={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},h={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},m={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},p={" ":h.space," ":h.space,"\n":h.space,"\r":h.space,"<":h.lt,">":h.gt,'"':h.quote,"'":h.quote,"=":h.equal,"/":h.slash},g=function(ie){return p[ie]||h.char},f=function(ie){var ae,re,ue,ye,be,ve,he,Pe,de,Te;ie=Object.assign({debug:!1},ie);var Ge=new A,Ye=_.data,fe="",Xe="",Fe="",we="",Ue="",De="",Ee=function(ze,je){if(!(Xe[0]==="?"||Xe[0]==="!")){var nt={type:ze,value:je};ie.debug&&console.log("emit:",nt),Ge.emit("data",nt)}};Ge.stateMachine=(Te={},u(Te,_.data,(ae={},u(ae,h.lt,function(){fe.trim()&&Ee(m.text,fe),Xe="",Ue=!1,Ye=_.tagBegin}),u(ae,h.char,function(Me){fe+=Me}),ae)),u(Te,_.cdata,u({},h.char,function(Me){fe+=Me,fe.substr(-3)==="]]>"&&(Ee(m.text,fe.slice(0,-3)),fe="",Ye=_.data)})),u(Te,_.tagBegin,(re={},u(re,h.space,d),u(re,h.char,function(Me){Xe=Me,Ye=_.tagName}),u(re,h.slash,function(){Xe="",Ue=!0}),re)),u(Te,_.tagName,(ue={},u(ue,h.space,function(){Ue?Ye=_.tagEnd:(Ye=_.attributeNameStart,Ee(m.openTag,Xe))}),u(ue,h.gt,function(){Ee(Ue?m.closeTag:m.openTag,Xe),fe="",Ye=_.data}),u(ue,h.slash,function(){Ye=_.tagEnd,Ee(m.openTag,Xe)}),u(ue,h.char,function(Me){Xe+=Me,Xe==="![CDATA["&&(Ye=_.cdata,fe="",Xe="")}),ue)),u(Te,_.tagEnd,(ye={},u(ye,h.gt,function(){Ee(m.closeTag,Xe),fe="",Ye=_.data}),u(ye,h.char,d),ye)),u(Te,_.attributeNameStart,(be={},u(be,h.char,function(Me){Fe=Me,Ye=_.attributeName}),u(be,h.gt,function(){fe="",Ye=_.data}),u(be,h.space,d),u(be,h.slash,function(){Ue=!0,Ye=_.tagEnd}),be)),u(Te,_.attributeName,(ve={},u(ve,h.space,function(){Ye=_.attributeNameEnd}),u(ve,h.equal,function(){Ee(m.attributeName,Fe),Ye=_.attributeValueBegin}),u(ve,h.gt,function(){we="",Ee(m.attributeName,Fe),Ee(m.attributeValue,we),fe="",Ye=_.data}),u(ve,h.slash,function(){Ue=!0,we="",Ee(m.attributeName,Fe),Ee(m.attributeValue,we),Ye=_.tagEnd}),u(ve,h.char,function(Me){Fe+=Me}),ve)),u(Te,_.attributeNameEnd,(he={},u(he,h.space,d),u(he,h.equal,function(){Ee(m.attributeName,Fe),Ye=_.attributeValueBegin}),u(he,h.gt,function(){we="",Ee(m.attributeName,Fe),Ee(m.attributeValue,we),fe="",Ye=_.data}),u(he,h.char,function(Me){we="",Ee(m.attributeName,Fe),Ee(m.attributeValue,we),Fe=Me,Ye=_.attributeName}),he)),u(Te,_.attributeValueBegin,(Pe={},u(Pe,h.space,d),u(Pe,h.quote,function(Me){De=Me,we="",Ye=_.attributeValue}),u(Pe,h.gt,function(){we="",Ee(m.attributeValue,we),fe="",Ye=_.data}),u(Pe,h.char,function(Me){De="",we=Me,Ye=_.attributeValue}),Pe)),u(Te,_.attributeValue,(de={},u(de,h.space,function(Me){De?we+=Me:(Ee(m.attributeValue,we),Ye=_.attributeNameStart)}),u(de,h.quote,function(Me){De===Me?(Ee(m.attributeValue,we),Ye=_.attributeNameStart):we+=Me}),u(de,h.gt,function(Me){De?we+=Me:(Ee(m.attributeValue,we),fe="",Ye=_.data)}),u(de,h.slash,function(Me){De?we+=Me:(Ee(m.attributeValue,we),Ue=!0,Ye=_.tagEnd)}),u(de,h.char,function(Me){we+=Me}),de)),Te);var Le=function(ze){ie.debug&&console.log(Ye,ze);var je=Ge.stateMachine[Ye],nt=je[g(ze)]||je[h.error]||je[h.char];nt(ze)};return Ge.write=function(Me){for(var ze=Me.length,je=0;je<ze;je++)Le(Me[je])},Ge},y={State:_,Action:h,Type:m,create:f},C=y.Type,I={element:"element",text:"text"},E=function(ie){return Object.assign({name:"",type:I.element,value:"",parent:null,attributes:{},children:[]},ie)},b=function(ie){ie=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},ie);var ae=void 0,re=void 0,ue=void 0,ye=void 0,be=new A,ve=function(Pe){switch(Pe.type){case C.openTag:if(ue===null)ue=re,ue.name=Pe.value;else{var de=E({name:Pe.value,parent:ue});ue.children.push(de),ue=de}break;case C.closeTag:var Te=ue.parent;if(ie.parentNodes||(ue.parent=null),ue.name!==Pe.value)break;ie.stream&&Te===re&&(re.children=[],ue.parent=null),(!ie.emitTopLevelOnly||Te===re)&&(be.emit(ie.tagPrefix+ue.name,ue),be.emit("tag",ue.name,ue)),ue===re&&(ae.removeAllListeners("data"),be.emit(ie.doneEvent,ue),re=null),ue=Te;break;case C.text:ue&&ue.children.push(E({type:I.text,value:Pe.value,parent:ie.parentNodes?ue:null}));break;case C.attributeName:ye=Pe.value,ue.attributes[ye]="";break;case C.attributeValue:ue.attributes[ye]=Pe.value;break}};return be.reset=function(){ae=y.create({debug:ie.debug}),ae.on("data",ve),re=E(),ue=null,ye="",be.parse=ae.write},be.reset(),be},P=function(ie,ae){ae=Object.assign({},ae,{stream:!1,tagPrefix:":"});var re=b(ae),ue=void 0;return re.on("done",function(ye){ue=ye}),re.parse(ie),ue},B={parseSync:P},M=B.parseSync,k=function(ie){var ae=M("<root>".concat(ie,"</root>"),{parentNodes:!1}),re=ae.children&&ae.children.length>0&&ae.children.every(function(ue){return ue.name==="svg"});if(re)return ae.children.length===1?ae.children[0]:ae.children;throw Error("nothing to parse")},N=function(ie){return l(ie,function(ae){return F(ae)?ae:L(ae)})},L=function(ie){return ie.replace(/[-|:]([a-z])/gi,function(ae,re){return re.toUpperCase()})},F=function(ie){return/^(data|aria)(-\w+)/.test(ie)},G=function(ie){if(ie){var ae=String(ie);return/[&<>]/.test(ae)?"<![CDATA[".concat(ae.replace(/]]>/,"]]]]><![CDATA[>"),"]]>"):ae}return""},W=function(ie){return String(ie).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},j=function(ie){var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},re=ae.transformNode,ue=re===void 0?function(he){return he}:re,ye=ae.camelcase,be=ye===void 0?!1:ye,ve=function(Pe){var de;return de=ue(Pe),be&&(de=N(de)),de};return ve(k(ie))};function $(){for(var ee=arguments.length,ie=new Array(ee),ae=0;ae<ee;ae++)ie[ae]=arguments[ae];return new Promise(function(re,ue){try{var ye=j.apply(void 0,ie);re(ye)}catch(be){ue(be)}})}var oe=function ee(ie){var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},re=ae.transformAttr,ue=re===void 0?function(Ye,fe,Xe){return"".concat(Ye,'="').concat(Xe(fe),'"')}:re,ye=ae.transformNode,be=ye===void 0?function(Ye){return Ye}:ye,ve=ae.selfClose,he=ve===void 0?!0:ve;if(Array.isArray(ie))return ie.map(function(Ye){return ee(Ye,{transformAttr:ue,selfClose:he,transformNode:be})}).join("");var Pe=be(ie);if(Pe.type==="text")return G(Pe.value);var de="";for(var Te in Pe.attributes){var Ge=ue(Te,Pe.attributes[Te],W,Pe.name);de+=Ge?" ".concat(Ge):""}return Pe.children&&Pe.children.length>0||!he?"<".concat(Pe.name).concat(de,">").concat(ee(Pe.children,{transformAttr:ue,transformNode:be,selfClose:he}),"</").concat(Pe.name,">"):"<".concat(Pe.name).concat(de,"/>")},le=Object.assign({},{parse:$,parseSync:j,stringify:oe});return le})}}),zPe=Wc({"node_modules/js-beautify/js/src/core/output.js"(t,e){function n(r){this.__parent=r,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}n.prototype.clone_empty=function(){var r=new n(this.__parent);return r.set_indent(this.__indent_count,this.__alignment_count),r},n.prototype.item=function(r){return r<0?this.__items[this.__items.length+r]:this.__items[r]},n.prototype.has_match=function(r){for(var s=this.__items.length-1;s>=0;s--)if(this.__items[s].match(r))return!0;return!1},n.prototype.set_indent=function(r,s){this.is_empty()&&(this.__indent_count=r||0,this.__alignment_count=s||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},n.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},n.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},n.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var r=this.__parent.current_line;return r.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),r.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),r.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,r.__items[0]===" "&&(r.__items.splice(0,1),r.__character_count-=1),!0}return!1},n.prototype.is_empty=function(){return this.__items.length===0},n.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},n.prototype.push=function(r){this.__items.push(r);var s=r.lastIndexOf(`
|
|
5627
5627
|
`);s!==-1?this.__character_count=r.length-s:this.__character_count+=r.length},n.prototype.pop=function(){var r=null;return this.is_empty()||(r=this.__items.pop(),this.__character_count-=r.length),r},n.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},n.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},n.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},n.prototype.toString=function(){var r="";return this.is_empty()?this.__parent.indent_empty_lines&&(r=this.__parent.get_indent_string(this.__indent_count)):(r=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),r+=this.__items.join("")),r};function o(r,s){this.__cache=[""],this.__indent_size=r.indent_size,this.__indent_string=r.indent_char,r.indent_with_tabs||(this.__indent_string=new Array(r.indent_size+1).join(r.indent_char)),s=s||"",r.indent_level>0&&(s=new Array(r.indent_level+1).join(this.__indent_string)),this.__base_string=s,this.__base_string_length=s.length}o.prototype.get_indent_size=function(r,s){var a=this.__base_string_length;return s=s||0,r<0&&(a=0),a+=r*this.__indent_size,a+=s,a},o.prototype.get_indent_string=function(r,s){var a=this.__base_string;return s=s||0,r<0&&(r=0,a=""),s+=r*this.__indent_size,this.__ensure_cache(s),a+=this.__cache[s],a},o.prototype.__ensure_cache=function(r){for(;r>=this.__cache.length;)this.__add_column()},o.prototype.__add_column=function(){var r=this.__cache.length,s=0,a="";this.__indent_size&&r>=this.__indent_size&&(s=Math.floor(r/this.__indent_size),r-=s*this.__indent_size,a=new Array(s+1).join(this.__indent_string)),r&&(a+=new Array(r+1).join(" ")),this.__cache.push(a)};function i(r,s){this.__indent_cache=new o(r,s),this.raw=!1,this._end_with_newline=r.end_with_newline,this.indent_size=r.indent_size,this.wrap_line_length=r.wrap_line_length,this.indent_empty_lines=r.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new n(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}i.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},i.prototype.get_line_number=function(){return this.__lines.length},i.prototype.get_indent_string=function(r,s){return this.__indent_cache.get_indent_string(r,s)},i.prototype.get_indent_size=function(r,s){return this.__indent_cache.get_indent_size(r,s)},i.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},i.prototype.add_new_line=function(r){return this.is_empty()||!r&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},i.prototype.get_code=function(r){this.trim(!0);var s=this.current_line.pop();s&&(s[s.length-1]===`
|
|
@@ -5779,7 +5779,7 @@ test("${l} should solve problem correctly", () => {
|
|
|
5779
5779
|
// Add more specific assertions based on expected output
|
|
5780
5780
|
// expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
|
|
5781
5781
|
})
|
|
5782
|
-
`,u=new Blob([A],{type:"text/plain"}),d=URL.createObjectURL(u),_=document.createElement("a");_.href=d,_.download=`${l}.test.ts`,_.click(),URL.revokeObjectURL(d)}catch(c){alert(`Error generating test.ts for ${t.constructor.name}: ${c instanceof Error?c.message:String(c)}`)}o(!1)};return K.jsxs("div",{className:`relative ${e}`,ref:i,children:[K.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>o(!n),title:`Download options for ${t.constructor.name}`,children:t.constructor.name}),n&&K.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[K.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download JSON"}),K.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),K.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},ZSt=t=>t.activeSubSolver?[t,...ZSt(t.activeSubSolver)]:[t],B4o=({solver:t})=>{const e=ZSt(t);return K.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>K.jsxs("div",{className:"flex items-center",children:[o>0&&K.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),K.jsx(v4o,{solver:n})]},n.constructor.name))})},M4o=({solver:t,triggerRender:e,animationSpeed:n=25,onSolverStarted:o,onSolverCompleted:i})=>{const[r,s]=J.useReducer(m=>!m,!1),a=J.useRef(void 0),c=()=>{!t.solved&&!t.failed&&(t.step(),e())},l=()=>{!t.solved&&!t.failed&&(o&&o(t),t.solve(),e(),i&&i(t))},A=()=>{r?(a.current&&(clearInterval(a.current),a.current=void 0),s()):(s(),a.current=setInterval(()=>{if(t.solved||t.failed){a.current&&(clearInterval(a.current),a.current=void 0),s(),e(),i&&t.solved&&i(t);return}t.step(),e()},n))},u=()=>{const m=t;if(m.getCurrentPhase&&!t.solved&&!t.failed){const p=m.getCurrentPhase();for(;m.getCurrentPhase()===p&&!t.solved&&!t.failed;)t.step();e()}},d=()=>{if(t.solved||t.failed||r)return;const m=window.prompt("Step until which iteration?",`${t.iterations}`);if(m===null)return;const p=Number(m);if(!Number.isFinite(p)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<p&&!t.solved&&!t.failed;)t.step();e(),t.solved&&i&&i(t)};J.useEffect(()=>()=>{a.current&&clearInterval(a.current)},[]),J.useEffect(()=>{(t.solved||t.failed)&&r&&(a.current&&(clearInterval(a.current),a.current=void 0),s())},[t.solved,t.failed,r]);const _=t.getCurrentPhase!==void 0,h=_?t.getCurrentPhase():null;return K.jsxs("div",{className:"space-y-2 p-2 border-b",children:[K.jsx("div",{className:"flex items-center",children:K.jsx(B4o,{solver:t})}),K.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[K.jsx("button",{onClick:c,disabled:t.solved||t.failed||r,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),K.jsx("button",{onClick:l,disabled:t.solved||t.failed||r,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),K.jsx("button",{onClick:A,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${r?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:r?"Stop":"Animate"}),K.jsx("button",{onClick:d,disabled:t.solved||t.failed||r,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),_&&K.jsx("button",{onClick:u,disabled:t.solved||t.failed||r,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),K.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&K.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),h&&K.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",K.jsx("span",{className:"font-medium",children:h})]}),t.solved&&K.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&K.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&K.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},w4o=(t,e,n)=>{const o=t.currentPipelineStepIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},D4o=(t,e)=>{const o=t.pipelineDef[e].solverName,i=w4o(t,e),r=t[o],s=t.firstIterationOfPhase?.[o]??null,a=t.iterations;let c=0;if(i==="Completed"){const d=t.pipelineDef[e+1],_=d?t.firstIterationOfPhase?.[d.solverName]:void 0;_!==void 0&&s!==null?c=_-s:s!==null&&(c=a-s)}else i==="In Progress"&&s!==null&&(c=a-s);const l=t.timeSpentOnPhase?.[o]??0;let A=0;i==="Completed"?A=1:i==="In Progress"&&r&&(A=r.progress??0);const u=r?.stats??null;return{index:e,name:o,status:i,firstIteration:s,iterations:c,progress:A,timeSpent:l,stats:u&&Object.keys(u).length>0?u:null,solverInstance:r??null}},Q4o=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return K.jsx("span",{className:`font-medium ${e[t]}`,children:t})},T4o=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return K.jsxs("div",{className:"flex items-center gap-2",children:[K.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:K.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),K.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},R4o=t=>Object.entries(t).map(([e,n])=>`${e}: ${n}`).join(", "),N4o=({stats:t})=>{if(!t||Object.keys(t).length===0)return K.jsx("span",{children:"-"});const e=Object.entries(t),n=R4o(t);return K.jsxs("details",{className:"cursor-pointer",children:[K.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),K.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,i])=>K.jsxs("div",{children:[o,": ",String(i)]},o))})]})},tve=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(tve);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=tve(o));return e},k4o=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=tve(t.getConstructorParams()),o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`${e}_input.json`,r.click(),URL.revokeObjectURL(i)}catch(n){alert(`Error downloading input for ${e}: ${n instanceof Error?n.message:String(n)}`)}},H4o=({solver:t,onStepUntilPhase:e,onDownloadInput:n})=>{const o=t.pipelineDef.map((a,c)=>D4o(t,c)),i=a=>{e?.(a)},r=a=>{a.solverInstance&&(n?n(a.solverInstance,a.name):k4o(a.solverInstance,a.name))},s=a=>`${(a/1e3).toFixed(2)}s`;return K.jsxs("div",{className:"border-t border-gray-200",children:[K.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:K.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),K.jsx("div",{className:"overflow-x-auto",children:K.jsxs("table",{className:"w-full text-sm",children:[K.jsx("thead",{children:K.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),K.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",K.jsx("sub",{children:"0"})]}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),K.jsx("tbody",{children:o.map(a=>K.jsxs("tr",{className:`border-b border-gray-100 ${a.status==="In Progress"?"bg-yellow-50":""}`,children:[K.jsx("td",{className:"px-4 py-2",children:K.jsxs("div",{className:"flex items-center gap-2",children:[K.jsx("span",{className:"text-gray-400 w-6",children:String(a.index+1).padStart(2,"0")}),K.jsx("button",{onClick:()=>i(a.name),disabled:a.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${a.name} completes`,children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:K.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),K.jsx("span",{className:"font-medium text-gray-900",children:a.name})]})}),K.jsx("td",{className:"px-4 py-2",children:K.jsx(Q4o,{status:a.status})}),K.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:a.firstIteration!==null?a.firstIteration:""}),K.jsx("td",{className:"px-4 py-2 text-gray-600",children:a.iterations}),K.jsx("td",{className:"px-4 py-2",children:K.jsx(T4o,{progress:a.progress})}),K.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(a.timeSpent)}),K.jsx("td",{className:"px-4 py-2 text-gray-500",children:K.jsx(N4o,{stats:a.stats})}),K.jsx("td",{className:"px-4 py-2",children:a.solverInstance?K.jsxs("button",{onClick:()=>r(a),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${a.name}`,children:[K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:K.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),K.jsx("span",{children:"Input"})]}):null})]},a.name))})]})})]})},L4o=class extends lr.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function F4o({graphics:t}){const e=t.points??[],n=t.lines??[],o=t.rects??[],i=t.circles??[],r=t.texts??[];let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;const A=(p,g)=>{typeof p=="number"&&(p<s&&(s=p),p>c&&(c=p)),typeof g=="number"&&(g<a&&(a=g),g>l&&(l=g))};for(const p of e)A(p.x,p.y);for(const p of n){const g=p.points??[];for(const f of g)A(f.x,f.y)}for(const p of o){const g=p.x??0,f=p.y??0,y=p.width??0,C=p.height??0;A(g,f),A(g+y,f+C)}for(const p of i){const g=p.x??0,f=p.y??0,y=p.radius??1;A(g-y,f-y),A(g+y,f+y)}for(const p of r)A(p.x,p.y);(!isFinite(s)||!isFinite(a)||!isFinite(c)||!isFinite(l))&&(s=-20,a=-20,c=20,l=20);const u=10,d=s-u,_=a-u,h=Math.max(1,c-s+2*u),m=Math.max(1,l-a+2*u);return K.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${d} ${_} ${h} ${m}`,role:"img","aria-label":"Graphics fallback",children:[o.map((p,g)=>K.jsx("rect",{x:p.x??0,y:p.y??0,width:p.width??0,height:p.height??0,fill:"none",stroke:p.strokeColor??"black",strokeWidth:p.strokeWidth??1},`rect-${g}`)),n.map((p,g)=>K.jsx("polyline",{fill:"none",stroke:p.strokeColor??"black",strokeWidth:p.strokeWidth??1,points:(p.points??[]).map(f=>`${f.x??0},${f.y??0}`).join(" ")},`line-${g}`)),i.map((p,g)=>K.jsx("circle",{cx:p.x??0,cy:p.y??0,r:p.radius??1.5,fill:p.fillColor??"none",stroke:p.strokeColor??"black",strokeWidth:p.strokeWidth??1},`circle-${g}`)),e.map((p,g)=>K.jsx("circle",{cx:p.x??0,cy:p.y??0,r:p.radius??1.5,fill:p.color??"black"},`point-${g}`)),r.map((p,g)=>K.jsx("text",{x:p.x??0,y:p.y??0,fontSize:p.fontSize??10,fill:p.color??"black",children:p.text??""},`text-${g}`))]})}var O4o=({solver:t,animationSpeed:e=25,onSolverStarted:n,onSolverCompleted:o})=>{const[i,r]=J.useReducer(A=>A+1,0),s=J.useMemo(()=>{try{return t.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(A){return console.error("Visualization error:",A),{points:[],lines:[],rects:[],circles:[]}}},[t,i]),a=J.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);J.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const A=document.createElement("script");A.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(A)}},[]);const c=t.pipelineDef!==void 0,l=A=>{const u=t;if(!t.solved&&!t.failed){for(;!t.solved&&!t.failed&&u.currentPipelineStepIndex<=u.pipelineDef.findIndex(d=>d.solverName===A);)t.step();r()}};return K.jsxs("div",{children:[K.jsx(M4o,{solver:t,triggerRender:r,animationSpeed:e,onSolverStarted:n,onSolverCompleted:o}),a?K.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):K.jsx(L4o,{fallback:K.jsx(F4o,{graphics:s}),children:K.jsx(P4o,{graphics:s})}),c&&K.jsx(H4o,{solver:t,onStepUntilPhase:l})]})};const G4o=()=>{J.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const e=document.createElement("div");e.className="hidden",document.body.appendChild(e);const n=window.getComputedStyle(e).display==="none";if(document.body.removeChild(e),n)return;const o=document.createElement("script");o.id=t,o.src="https://cdn.tailwindcss.com",document.head.appendChild(o)},[])},U4o=t=>t.toLowerCase().includes("pack")?sco:t.toLowerCase().includes("rout")?uco:Yao,z4o=({solverEvents:t=[]})=>{const[e,n]=J.useState(null);G4o();const o=J.useMemo(()=>{const a=new Map;for(const c of t){const l=`${c.componentName}-${c.solverName}`;a.set(l,c)}return a},[t]),i=J.useMemo(()=>Array.from(o.keys()),[o]),r=e?o.get(e):null,s=J.useMemo(()=>{if(!r)return{instance:null,error:null,classFound:!1};const a=ime[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(ime).join(", ")}`,classFound:!1};try{const c=r.solverParams,l=c?.input!==void 0?c.input:c;return{instance:new a(l),error:null,classFound:!0}}catch(c){const l=c instanceof Error?c.message:String(c);return console.error("Failed to reconstruct solver:",c),{instance:null,error:`Failed to instantiate solver: ${l}`,classFound:!0}}},[r]);return t.length===0?K.jsx("div",{className:"rf-p-4",children:K.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:K.jsxs("div",{className:"rf-p-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),K.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):K.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[K.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[K.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[i.length," ",i.length===1?"Solver":"Solvers"]}),i.map(a=>{const c=o.get(a),l=e===a;return K.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${l?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>n(a),children:(()=>{const A=U4o(c.solverName);return K.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[K.jsx(A,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),K.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[K.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:c.componentName}),K.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:c.solverName})]})]})})()},a)})]}),K.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:r?s.instance?K.jsx(J2,{fallback:K.jsx("div",{className:"rf-p-4",children:K.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),K.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",r.solverName]})]})}),children:K.jsx(O4o,{solver:s.instance})}):K.jsxs("div",{className:"rf-p-4",children:[K.jsxs("div",{className:"rf-mb-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:r.solverName}),K.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",r.componentName]})]}),s.error&&K.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:K.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),K.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[K.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:K.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),K.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:K.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(r.solverParams,null,2)})})]})]}):K.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:K.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},e3t=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{J.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{Ww.captureException(o)}catch{}}},[t,e]),J.useEffect(()=>{if(n&&n.length>0)for(const o of n){const i=new Error(o.message||"Circuit JSON Error");o.stack&&(i.stack=o.stack);try{Ww.captureException(i,{error_type:o.type})}catch{}}},[n])},t3t=t=>{J.useEffect(()=>{try{PBn(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},n3t="0.0.2073",V4o={version:n3t},cte=Wtt()(jtt(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{t({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),Y4o=t=>{const[e,n]=J.useState([]),[o,i]=J.useState(null),[r,s]=J.useState(""),[a,c]=bw("eval-version-selection",null),l=cte(_=>_.setLastRunEvalVersion),A=cte(_=>_.lastRunEvalVersion);return J.useEffect(()=>{t&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(_=>_.json()).then(_=>{if(Array.isArray(_?.versions)){let h=[..._.versions];_.tags?.latest&&(i(_.tags.latest),h=h.filter(m=>m!==_.tags.latest)),n(h)}}).catch(()=>{})},[t]),J.useEffect(()=>{t&&(a?(window.TSCIRCUIT_LATEST_EVAL_VERSION=a,l(a)):o&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=o,l(o)))},[t,a,o]),{versions:J.useMemo(()=>e.filter(_=>_.includes(r)).slice(0,50),[e,r]),latestVersion:o,lastRunEvalVersion:A,search:r,setSearch:s,selectVersion:_=>{c(_),s("")}}},K4o=({snippetNames:t,onSelect:e,onCancel:n,isOpen:o})=>{const[i,r]=J.useState(""),[s,a]=J.useState("");if(!o)return null;const c=t.filter(u=>u.toLowerCase().includes(s.toLowerCase())),l=s&&!t.includes(s),A=u=>{u.key==="Enter"&&(c.length===1?r(c[0]):l&&r(s))};return K.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]",children:K.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[K.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),K.jsx("input",{type:"text",className:"rf-w-full rf-px-4 rf-py-2 rf-border rf-rounded rf-mb-4",placeholder:"Search snippets or new snippet name...",value:s,onChange:u=>a(u.target.value),onKeyDown:A}),K.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[c.map(u=>K.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${i===u?"bg-blue-50":""}`,onClick:()=>r(u),children:u},u)),l&&K.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${i===s?"bg-blue-50":""}`,onClick:()=>r(s),children:['Create new "',s,'"']})]}),K.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[K.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:n,children:"Cancel"}),K.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600 rf-disabled:opacity-50",onClick:()=>i&&e(i),disabled:!i,children:i===s?`Create "${i}"`:`Save to ${i}`})]})]})})},W4o=t=>{const e=J.useRef(null),n=p0(o=>o.recentEvents);J.useEffect(()=>{if(n.length===0)return;const o=n[0];o.event_id!==e.current&&(t(o),e.current=o.event_id)},[n,t])};var lte="Dialog",[o3t,i3t]=zI(lte),[j4o,g5]=o3t(lte),r3t=t=>{const{__scopeDialog:e,children:n,open:o,defaultOpen:i,onOpenChange:r,modal:s=!0}=t,a=J.useRef(null),c=J.useRef(null),[l,A]=rP({prop:o,defaultProp:i??!1,onChange:r,caller:lte});return K.jsx(j4o,{scope:e,triggerRef:a,contentRef:c,contentId:hp(),titleId:hp(),descriptionId:hp(),open:l,onOpenChange:A,onOpenToggle:J.useCallback(()=>A(u=>!u),[A]),modal:s,children:n})};r3t.displayName=lte;var s3t="DialogTrigger",a3t=J.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,i=g5(s3t,n),r=f0(e,i.triggerRef);return K.jsx(ka.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":ive(i.open),...o,ref:r,onClick:Sr(t.onClick,i.onOpenToggle)})});a3t.displayName=s3t;var nve="DialogPortal",[X4o,c3t]=o3t(nve,{forceMount:void 0}),l3t=t=>{const{__scopeDialog:e,forceMount:n,children:o,container:i}=t,r=g5(nve,e);return K.jsx(X4o,{scope:e,forceMount:n,children:J.Children.map(o,s=>K.jsx(ux,{present:n||r.open,children:K.jsx(MZ,{asChild:!0,container:i,children:s})}))})};l3t.displayName=nve;var Ate="DialogOverlay",A3t=J.forwardRef((t,e)=>{const n=c3t(Ate,t.__scopeDialog),{forceMount:o=n.forceMount,...i}=t,r=g5(Ate,t.__scopeDialog);return r.modal?K.jsx(ux,{present:o||r.open,children:K.jsx(q4o,{...i,ref:e})}):null});A3t.displayName=Ate;var J4o=MB("DialogOverlay.RemoveScroll"),q4o=J.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,i=g5(Ate,n);return K.jsx(HZ,{as:J4o,allowPinchZoom:!0,shards:[i.contentRef],children:K.jsx(ka.div,{"data-state":ive(i.open),...o,ref:e,style:{pointerEvents:"auto",...o.style}})})}),q8="DialogContent",u3t=J.forwardRef((t,e)=>{const n=c3t(q8,t.__scopeDialog),{forceMount:o=n.forceMount,...i}=t,r=g5(q8,t.__scopeDialog);return K.jsx(ux,{present:o||r.open,children:r.modal?K.jsx($4o,{...i,ref:e}):K.jsx(Z4o,{...i,ref:e})})});u3t.displayName=q8;var $4o=J.forwardRef((t,e)=>{const n=g5(q8,t.__scopeDialog),o=J.useRef(null),i=f0(e,n.contentRef,o);return J.useEffect(()=>{const r=o.current;if(r)return t3e(r)},[]),K.jsx(d3t,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Sr(t.onCloseAutoFocus,r=>{r.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Sr(t.onPointerDownOutside,r=>{const s=r.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&r.preventDefault()}),onFocusOutside:Sr(t.onFocusOutside,r=>r.preventDefault())})}),Z4o=J.forwardRef((t,e)=>{const n=g5(q8,t.__scopeDialog),o=J.useRef(!1),i=J.useRef(!1);return K.jsx(d3t,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{t.onCloseAutoFocus?.(r),r.defaultPrevented||(o.current||n.triggerRef.current?.focus(),r.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:r=>{t.onInteractOutside?.(r),r.defaultPrevented||(o.current=!0,r.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=r.target;n.triggerRef.current?.contains(s)&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&i.current&&r.preventDefault()}})}),d3t=J.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:r,...s}=t,a=g5(q8,n),c=J.useRef(null),l=f0(e,c);return RSe(),K.jsxs(K.Fragment,{children:[K.jsx(gZ,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:r,children:K.jsx(pF,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ive(a.open),...s,ref:l,onDismiss:()=>a.onOpenChange(!1)})}),K.jsxs(K.Fragment,{children:[K.jsx(tEo,{titleId:a.titleId}),K.jsx(oEo,{contentRef:c,descriptionId:a.descriptionId})]})]})}),ove="DialogTitle",h3t=J.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,i=g5(ove,n);return K.jsx(ka.h2,{id:i.titleId,...o,ref:e})});h3t.displayName=ove;var _3t="DialogDescription",m3t=J.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,i=g5(_3t,n);return K.jsx(ka.p,{id:i.descriptionId,...o,ref:e})});m3t.displayName=_3t;var g3t="DialogClose",p3t=J.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,i=g5(g3t,n);return K.jsx(ka.button,{type:"button",...o,ref:e,onClick:Sr(t.onClick,()=>i.onOpenChange(!1))})});p3t.displayName=g3t;function ive(t){return t?"open":"closed"}var f3t="DialogTitleWarning",[eEo,y3t]=S3n(f3t,{contentName:q8,titleName:ove,docsSlug:"dialog"}),tEo=({titleId:t})=>{const e=y3t(f3t),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
5782
|
+
`,u=new Blob([A],{type:"text/plain"}),d=URL.createObjectURL(u),_=document.createElement("a");_.href=d,_.download=`${l}.test.ts`,_.click(),URL.revokeObjectURL(d)}catch(c){alert(`Error generating test.ts for ${t.constructor.name}: ${c instanceof Error?c.message:String(c)}`)}o(!1)};return K.jsxs("div",{className:`relative ${e}`,ref:i,children:[K.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>o(!n),title:`Download options for ${t.constructor.name}`,children:t.constructor.name}),n&&K.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[K.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download JSON"}),K.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),K.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},ZSt=t=>t.activeSubSolver?[t,...ZSt(t.activeSubSolver)]:[t],B4o=({solver:t})=>{const e=ZSt(t);return K.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>K.jsxs("div",{className:"flex items-center",children:[o>0&&K.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),K.jsx(v4o,{solver:n})]},n.constructor.name))})},M4o=({solver:t,triggerRender:e,animationSpeed:n=25,onSolverStarted:o,onSolverCompleted:i})=>{const[r,s]=J.useReducer(m=>!m,!1),a=J.useRef(void 0),c=()=>{!t.solved&&!t.failed&&(t.step(),e())},l=()=>{!t.solved&&!t.failed&&(o&&o(t),t.solve(),e(),i&&i(t))},A=()=>{r?(a.current&&(clearInterval(a.current),a.current=void 0),s()):(s(),a.current=setInterval(()=>{if(t.solved||t.failed){a.current&&(clearInterval(a.current),a.current=void 0),s(),e(),i&&t.solved&&i(t);return}t.step(),e()},n))},u=()=>{const m=t;if(m.getCurrentPhase&&!t.solved&&!t.failed){const p=m.getCurrentPhase();for(;m.getCurrentPhase()===p&&!t.solved&&!t.failed;)t.step();e()}},d=()=>{if(t.solved||t.failed||r)return;const m=window.prompt("Step until which iteration?",`${t.iterations}`);if(m===null)return;const p=Number(m);if(!Number.isFinite(p)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<p&&!t.solved&&!t.failed;)t.step();e(),t.solved&&i&&i(t)};J.useEffect(()=>()=>{a.current&&clearInterval(a.current)},[]),J.useEffect(()=>{(t.solved||t.failed)&&r&&(a.current&&(clearInterval(a.current),a.current=void 0),s())},[t.solved,t.failed,r]);const _=t.getCurrentPhase!==void 0,h=_?t.getCurrentPhase():null;return K.jsxs("div",{className:"space-y-2 p-2 border-b",children:[K.jsx("div",{className:"flex items-center",children:K.jsx(B4o,{solver:t})}),K.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[K.jsx("button",{onClick:c,disabled:t.solved||t.failed||r,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),K.jsx("button",{onClick:l,disabled:t.solved||t.failed||r,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),K.jsx("button",{onClick:A,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${r?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:r?"Stop":"Animate"}),K.jsx("button",{onClick:d,disabled:t.solved||t.failed||r,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),_&&K.jsx("button",{onClick:u,disabled:t.solved||t.failed||r,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),K.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&K.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),h&&K.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",K.jsx("span",{className:"font-medium",children:h})]}),t.solved&&K.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&K.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&K.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},w4o=(t,e,n)=>{const o=t.currentPipelineStepIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},D4o=(t,e)=>{const o=t.pipelineDef[e].solverName,i=w4o(t,e),r=t[o],s=t.firstIterationOfPhase?.[o]??null,a=t.iterations;let c=0;if(i==="Completed"){const d=t.pipelineDef[e+1],_=d?t.firstIterationOfPhase?.[d.solverName]:void 0;_!==void 0&&s!==null?c=_-s:s!==null&&(c=a-s)}else i==="In Progress"&&s!==null&&(c=a-s);const l=t.timeSpentOnPhase?.[o]??0;let A=0;i==="Completed"?A=1:i==="In Progress"&&r&&(A=r.progress??0);const u=r?.stats??null;return{index:e,name:o,status:i,firstIteration:s,iterations:c,progress:A,timeSpent:l,stats:u&&Object.keys(u).length>0?u:null,solverInstance:r??null}},Q4o=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return K.jsx("span",{className:`font-medium ${e[t]}`,children:t})},T4o=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return K.jsxs("div",{className:"flex items-center gap-2",children:[K.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:K.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),K.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},R4o=t=>Object.entries(t).map(([e,n])=>`${e}: ${n}`).join(", "),N4o=({stats:t})=>{if(!t||Object.keys(t).length===0)return K.jsx("span",{children:"-"});const e=Object.entries(t),n=R4o(t);return K.jsxs("details",{className:"cursor-pointer",children:[K.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),K.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,i])=>K.jsxs("div",{children:[o,": ",String(i)]},o))})]})},tve=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(tve);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=tve(o));return e},k4o=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=tve(t.getConstructorParams()),o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`${e}_input.json`,r.click(),URL.revokeObjectURL(i)}catch(n){alert(`Error downloading input for ${e}: ${n instanceof Error?n.message:String(n)}`)}},H4o=({solver:t,onStepUntilPhase:e,onDownloadInput:n})=>{const o=t.pipelineDef.map((a,c)=>D4o(t,c)),i=a=>{e?.(a)},r=a=>{a.solverInstance&&(n?n(a.solverInstance,a.name):k4o(a.solverInstance,a.name))},s=a=>`${(a/1e3).toFixed(2)}s`;return K.jsxs("div",{className:"border-t border-gray-200",children:[K.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:K.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),K.jsx("div",{className:"overflow-x-auto",children:K.jsxs("table",{className:"w-full text-sm",children:[K.jsx("thead",{children:K.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),K.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",K.jsx("sub",{children:"0"})]}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),K.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),K.jsx("tbody",{children:o.map(a=>K.jsxs("tr",{className:`border-b border-gray-100 ${a.status==="In Progress"?"bg-yellow-50":""}`,children:[K.jsx("td",{className:"px-4 py-2",children:K.jsxs("div",{className:"flex items-center gap-2",children:[K.jsx("span",{className:"text-gray-400 w-6",children:String(a.index+1).padStart(2,"0")}),K.jsx("button",{onClick:()=>i(a.name),disabled:a.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${a.name} completes`,children:K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:K.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),K.jsx("span",{className:"font-medium text-gray-900",children:a.name})]})}),K.jsx("td",{className:"px-4 py-2",children:K.jsx(Q4o,{status:a.status})}),K.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:a.firstIteration!==null?a.firstIteration:""}),K.jsx("td",{className:"px-4 py-2 text-gray-600",children:a.iterations}),K.jsx("td",{className:"px-4 py-2",children:K.jsx(T4o,{progress:a.progress})}),K.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(a.timeSpent)}),K.jsx("td",{className:"px-4 py-2 text-gray-500",children:K.jsx(N4o,{stats:a.stats})}),K.jsx("td",{className:"px-4 py-2",children:a.solverInstance?K.jsxs("button",{onClick:()=>r(a),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${a.name}`,children:[K.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:K.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),K.jsx("span",{children:"Input"})]}):null})]},a.name))})]})})]})},L4o=class extends lr.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function F4o({graphics:t}){const e=t.points??[],n=t.lines??[],o=t.rects??[],i=t.circles??[],r=t.texts??[];let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;const A=(p,g)=>{typeof p=="number"&&(p<s&&(s=p),p>c&&(c=p)),typeof g=="number"&&(g<a&&(a=g),g>l&&(l=g))};for(const p of e)A(p.x,p.y);for(const p of n){const g=p.points??[];for(const f of g)A(f.x,f.y)}for(const p of o){const g=p.x??0,f=p.y??0,y=p.width??0,C=p.height??0;A(g,f),A(g+y,f+C)}for(const p of i){const g=p.x??0,f=p.y??0,y=p.radius??1;A(g-y,f-y),A(g+y,f+y)}for(const p of r)A(p.x,p.y);(!isFinite(s)||!isFinite(a)||!isFinite(c)||!isFinite(l))&&(s=-20,a=-20,c=20,l=20);const u=10,d=s-u,_=a-u,h=Math.max(1,c-s+2*u),m=Math.max(1,l-a+2*u);return K.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${d} ${_} ${h} ${m}`,role:"img","aria-label":"Graphics fallback",children:[o.map((p,g)=>K.jsx("rect",{x:p.x??0,y:p.y??0,width:p.width??0,height:p.height??0,fill:"none",stroke:p.strokeColor??"black",strokeWidth:p.strokeWidth??1},`rect-${g}`)),n.map((p,g)=>K.jsx("polyline",{fill:"none",stroke:p.strokeColor??"black",strokeWidth:p.strokeWidth??1,points:(p.points??[]).map(f=>`${f.x??0},${f.y??0}`).join(" ")},`line-${g}`)),i.map((p,g)=>K.jsx("circle",{cx:p.x??0,cy:p.y??0,r:p.radius??1.5,fill:p.fillColor??"none",stroke:p.strokeColor??"black",strokeWidth:p.strokeWidth??1},`circle-${g}`)),e.map((p,g)=>K.jsx("circle",{cx:p.x??0,cy:p.y??0,r:p.radius??1.5,fill:p.color??"black"},`point-${g}`)),r.map((p,g)=>K.jsx("text",{x:p.x??0,y:p.y??0,fontSize:p.fontSize??10,fill:p.color??"black",children:p.text??""},`text-${g}`))]})}var O4o=({solver:t,animationSpeed:e=25,onSolverStarted:n,onSolverCompleted:o})=>{const[i,r]=J.useReducer(A=>A+1,0),s=J.useMemo(()=>{try{return t.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(A){return console.error("Visualization error:",A),{points:[],lines:[],rects:[],circles:[]}}},[t,i]),a=J.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);J.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const A=document.createElement("script");A.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(A)}},[]);const c=t.pipelineDef!==void 0,l=A=>{const u=t;if(!t.solved&&!t.failed){for(;!t.solved&&!t.failed&&u.currentPipelineStepIndex<=u.pipelineDef.findIndex(d=>d.solverName===A);)t.step();r()}};return K.jsxs("div",{children:[K.jsx(M4o,{solver:t,triggerRender:r,animationSpeed:e,onSolverStarted:n,onSolverCompleted:o}),a?K.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):K.jsx(L4o,{fallback:K.jsx(F4o,{graphics:s}),children:K.jsx(P4o,{graphics:s})}),c&&K.jsx(H4o,{solver:t,onStepUntilPhase:l})]})};const G4o=()=>{J.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const e=document.createElement("div");e.className="hidden",document.body.appendChild(e);const n=window.getComputedStyle(e).display==="none";if(document.body.removeChild(e),n)return;const o=document.createElement("script");o.id=t,o.src="https://cdn.tailwindcss.com",document.head.appendChild(o)},[])},U4o=t=>t.toLowerCase().includes("pack")?sco:t.toLowerCase().includes("rout")?uco:Yao,z4o=({solverEvents:t=[]})=>{const[e,n]=J.useState(null);G4o();const o=J.useMemo(()=>{const a=new Map;for(const c of t){const l=`${c.componentName}-${c.solverName}`;a.set(l,c)}return a},[t]),i=J.useMemo(()=>Array.from(o.keys()),[o]),r=e?o.get(e):null,s=J.useMemo(()=>{if(!r)return{instance:null,error:null,classFound:!1};const a=ime[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(ime).join(", ")}`,classFound:!1};try{const c=r.solverParams,l=c?.input!==void 0?c.input:c;return{instance:new a(l),error:null,classFound:!0}}catch(c){const l=c instanceof Error?c.message:String(c);return console.error("Failed to reconstruct solver:",c),{instance:null,error:`Failed to instantiate solver: ${l}`,classFound:!0}}},[r]);return t.length===0?K.jsx("div",{className:"rf-p-4",children:K.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:K.jsxs("div",{className:"rf-p-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),K.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):K.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[K.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[K.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[i.length," ",i.length===1?"Solver":"Solvers"]}),i.map(a=>{const c=o.get(a),l=e===a;return K.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${l?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>n(a),children:(()=>{const A=U4o(c.solverName);return K.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[K.jsx(A,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),K.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[K.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:c.componentName}),K.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:c.solverName})]})]})})()},a)})]}),K.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:r?s.instance?K.jsx(J2,{fallback:K.jsx("div",{className:"rf-p-4",children:K.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),K.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",r.solverName]})]})}),children:K.jsx(O4o,{solver:s.instance})}):K.jsxs("div",{className:"rf-p-4",children:[K.jsxs("div",{className:"rf-mb-4",children:[K.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:r.solverName}),K.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",r.componentName]})]}),s.error&&K.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:K.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),K.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[K.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:K.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),K.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:K.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(r.solverParams,null,2)})})]})]}):K.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:K.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},e3t=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{J.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{Ww.captureException(o)}catch{}}},[t,e]),J.useEffect(()=>{if(n&&n.length>0)for(const o of n){const i=new Error(o.message||"Circuit JSON Error");o.stack&&(i.stack=o.stack);try{Ww.captureException(i,{error_type:o.type})}catch{}}},[n])},t3t=t=>{J.useEffect(()=>{try{PBn(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},n3t="0.0.2075",V4o={version:n3t},cte=Wtt()(jtt(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{t({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),Y4o=t=>{const[e,n]=J.useState([]),[o,i]=J.useState(null),[r,s]=J.useState(""),[a,c]=bw("eval-version-selection",null),l=cte(_=>_.setLastRunEvalVersion),A=cte(_=>_.lastRunEvalVersion);return J.useEffect(()=>{t&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(_=>_.json()).then(_=>{if(Array.isArray(_?.versions)){let h=[..._.versions];_.tags?.latest&&(i(_.tags.latest),h=h.filter(m=>m!==_.tags.latest)),n(h)}}).catch(()=>{})},[t]),J.useEffect(()=>{t&&(a?(window.TSCIRCUIT_LATEST_EVAL_VERSION=a,l(a)):o&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=o,l(o)))},[t,a,o]),{versions:J.useMemo(()=>e.filter(_=>_.includes(r)).slice(0,50),[e,r]),latestVersion:o,lastRunEvalVersion:A,search:r,setSearch:s,selectVersion:_=>{c(_),s("")}}},K4o=({snippetNames:t,onSelect:e,onCancel:n,isOpen:o})=>{const[i,r]=J.useState(""),[s,a]=J.useState("");if(!o)return null;const c=t.filter(u=>u.toLowerCase().includes(s.toLowerCase())),l=s&&!t.includes(s),A=u=>{u.key==="Enter"&&(c.length===1?r(c[0]):l&&r(s))};return K.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]",children:K.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[K.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),K.jsx("input",{type:"text",className:"rf-w-full rf-px-4 rf-py-2 rf-border rf-rounded rf-mb-4",placeholder:"Search snippets or new snippet name...",value:s,onChange:u=>a(u.target.value),onKeyDown:A}),K.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[c.map(u=>K.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${i===u?"bg-blue-50":""}`,onClick:()=>r(u),children:u},u)),l&&K.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${i===s?"bg-blue-50":""}`,onClick:()=>r(s),children:['Create new "',s,'"']})]}),K.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[K.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:n,children:"Cancel"}),K.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600 rf-disabled:opacity-50",onClick:()=>i&&e(i),disabled:!i,children:i===s?`Create "${i}"`:`Save to ${i}`})]})]})})},W4o=t=>{const e=J.useRef(null),n=p0(o=>o.recentEvents);J.useEffect(()=>{if(n.length===0)return;const o=n[0];o.event_id!==e.current&&(t(o),e.current=o.event_id)},[n,t])};var lte="Dialog",[o3t,i3t]=zI(lte),[j4o,g5]=o3t(lte),r3t=t=>{const{__scopeDialog:e,children:n,open:o,defaultOpen:i,onOpenChange:r,modal:s=!0}=t,a=J.useRef(null),c=J.useRef(null),[l,A]=rP({prop:o,defaultProp:i??!1,onChange:r,caller:lte});return K.jsx(j4o,{scope:e,triggerRef:a,contentRef:c,contentId:hp(),titleId:hp(),descriptionId:hp(),open:l,onOpenChange:A,onOpenToggle:J.useCallback(()=>A(u=>!u),[A]),modal:s,children:n})};r3t.displayName=lte;var s3t="DialogTrigger",a3t=J.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,i=g5(s3t,n),r=f0(e,i.triggerRef);return K.jsx(ka.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":ive(i.open),...o,ref:r,onClick:Sr(t.onClick,i.onOpenToggle)})});a3t.displayName=s3t;var nve="DialogPortal",[X4o,c3t]=o3t(nve,{forceMount:void 0}),l3t=t=>{const{__scopeDialog:e,forceMount:n,children:o,container:i}=t,r=g5(nve,e);return K.jsx(X4o,{scope:e,forceMount:n,children:J.Children.map(o,s=>K.jsx(ux,{present:n||r.open,children:K.jsx(MZ,{asChild:!0,container:i,children:s})}))})};l3t.displayName=nve;var Ate="DialogOverlay",A3t=J.forwardRef((t,e)=>{const n=c3t(Ate,t.__scopeDialog),{forceMount:o=n.forceMount,...i}=t,r=g5(Ate,t.__scopeDialog);return r.modal?K.jsx(ux,{present:o||r.open,children:K.jsx(q4o,{...i,ref:e})}):null});A3t.displayName=Ate;var J4o=MB("DialogOverlay.RemoveScroll"),q4o=J.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,i=g5(Ate,n);return K.jsx(HZ,{as:J4o,allowPinchZoom:!0,shards:[i.contentRef],children:K.jsx(ka.div,{"data-state":ive(i.open),...o,ref:e,style:{pointerEvents:"auto",...o.style}})})}),q8="DialogContent",u3t=J.forwardRef((t,e)=>{const n=c3t(q8,t.__scopeDialog),{forceMount:o=n.forceMount,...i}=t,r=g5(q8,t.__scopeDialog);return K.jsx(ux,{present:o||r.open,children:r.modal?K.jsx($4o,{...i,ref:e}):K.jsx(Z4o,{...i,ref:e})})});u3t.displayName=q8;var $4o=J.forwardRef((t,e)=>{const n=g5(q8,t.__scopeDialog),o=J.useRef(null),i=f0(e,n.contentRef,o);return J.useEffect(()=>{const r=o.current;if(r)return t3e(r)},[]),K.jsx(d3t,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Sr(t.onCloseAutoFocus,r=>{r.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Sr(t.onPointerDownOutside,r=>{const s=r.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&r.preventDefault()}),onFocusOutside:Sr(t.onFocusOutside,r=>r.preventDefault())})}),Z4o=J.forwardRef((t,e)=>{const n=g5(q8,t.__scopeDialog),o=J.useRef(!1),i=J.useRef(!1);return K.jsx(d3t,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{t.onCloseAutoFocus?.(r),r.defaultPrevented||(o.current||n.triggerRef.current?.focus(),r.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:r=>{t.onInteractOutside?.(r),r.defaultPrevented||(o.current=!0,r.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=r.target;n.triggerRef.current?.contains(s)&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&i.current&&r.preventDefault()}})}),d3t=J.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:r,...s}=t,a=g5(q8,n),c=J.useRef(null),l=f0(e,c);return RSe(),K.jsxs(K.Fragment,{children:[K.jsx(gZ,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:r,children:K.jsx(pF,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ive(a.open),...s,ref:l,onDismiss:()=>a.onOpenChange(!1)})}),K.jsxs(K.Fragment,{children:[K.jsx(tEo,{titleId:a.titleId}),K.jsx(oEo,{contentRef:c,descriptionId:a.descriptionId})]})]})}),ove="DialogTitle",h3t=J.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,i=g5(ove,n);return K.jsx(ka.h2,{id:i.titleId,...o,ref:e})});h3t.displayName=ove;var _3t="DialogDescription",m3t=J.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,i=g5(_3t,n);return K.jsx(ka.p,{id:i.descriptionId,...o,ref:e})});m3t.displayName=_3t;var g3t="DialogClose",p3t=J.forwardRef((t,e)=>{const{__scopeDialog:n,...o}=t,i=g5(g3t,n);return K.jsx(ka.button,{type:"button",...o,ref:e,onClick:Sr(t.onClick,()=>i.onOpenChange(!1))})});p3t.displayName=g3t;function ive(t){return t?"open":"closed"}var f3t="DialogTitleWarning",[eEo,y3t]=S3n(f3t,{contentName:q8,titleName:ove,docsSlug:"dialog"}),tEo=({titleId:t})=>{const e=y3t(f3t),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
5783
5783
|
|
|
5784
5784
|
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
5785
5785
|
|