revise 1.0.0 → 2.0.0
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/CHANGELOG.md +962 -0
- package/FONT-LICENSE-HAN-EXT-B.txt +91 -0
- package/FONT-LICENSE-KATEX.txt +95 -0
- package/FONT-LICENSE-LIBERATION.txt +102 -0
- package/FONT-LICENSE-NOTO-MULTILINGUAL.txt +93 -0
- package/FONT-LICENSE-NOTO-SANS-SC.txt +93 -0
- package/FONT-LICENSE-NOTO.txt +94 -0
- package/FONT-LICENSE-SOURCE-CODE-PRO.txt +94 -0
- package/FONT-LICENSE-SOURCE-SERIF-4.txt +93 -0
- package/LICENSE +41 -21
- package/README.md +39 -1
- package/THIRD-PARTY-NOTICES.md +3376 -0
- package/assets/historyMaterializeWorker-CoAX9ZAi.js +3 -0
- package/backend.d.ts +133 -0
- package/backend.js +1 -0
- package/chunks/AgentPageRenderer-C0n4EnuW.js +1 -0
- package/chunks/AgentPageRenderer-DURfmiu0.js +1 -0
- package/chunks/AttachmentDocumentImporter-DSic_6At.js +1 -0
- package/chunks/AttachmentDocumentImporter-dNMtkxrv.js +1 -0
- package/chunks/BidiText-B4Hzrjg9.js +1 -0
- package/chunks/ColorParserFull-BKH72fK8.js +1 -0
- package/chunks/DocumentStylesheet-byN5dtC6.js +1 -0
- package/chunks/DocxConverter-B7P52lw7.js +11 -0
- package/chunks/DocxConverter-COV6CjUM.js +11 -0
- package/chunks/DocxConverter-Cq_zCEJC.js +11 -0
- package/chunks/DocxGraft-CJ12C9WP.js +1 -0
- package/chunks/DocxGraft-CQpvFcYb.js +1 -0
- package/chunks/DocxGraft-DcmFuUkd.js +1 -0
- package/chunks/FileImporter-DVnYOJHp.js +1 -0
- package/chunks/FileImporter-q9mCch0J.js +1 -0
- package/chunks/HorizontalRuleOrnaments-gmUZ3R7Q.js +1 -0
- package/chunks/HtmlConverter-JvRlkQM3.js +61 -0
- package/chunks/ListNumbering-Qlu6AuRZ.js +1 -0
- package/chunks/MarkdownConverter-B-tPY7X3.js +17 -0
- package/chunks/MathRenderer-B0Y1h1JU.js +33 -0
- package/chunks/OdtConverter-Br81BSoJ.js +1 -0
- package/chunks/OdtConverter-CQjh0vlo.js +1 -0
- package/chunks/OdtConverter-DYHnR4E8.js +1 -0
- package/chunks/PdfConverter-D26rXumc.js +21 -0
- package/chunks/PdfConverter-DGZpUSVf.js +21 -0
- package/chunks/PdfConverter-DZzVP0-B.js +21 -0
- package/chunks/PdfImportService-CBD8TL1k.js +2 -0
- package/chunks/PdfImportService-D6uUKGMf.js +2 -0
- package/chunks/RtfConverter-BQGge3K-.js +14 -0
- package/chunks/RtfConverter-CMfZ4olw.js +14 -0
- package/chunks/RtfConverter-oIwzoqCD.js +14 -0
- package/chunks/TableBorders-BLkZYt1k.js +1 -0
- package/chunks/TableGrid-DVWaRZv0.js +1 -0
- package/chunks/TextFileDecoder--rsVs3NR.js +2 -0
- package/chunks/TxtConverter-C1lp6dBS.js +11 -0
- package/chunks/__vite-browser-external-l0sNRNKZ.js +0 -0
- package/chunks/_commonjsHelpers-DaMA6jEr.js +1 -0
- package/chunks/_revise-sdk-lazy-harfbuzz-CDWdjF9f.js +1 -0
- package/chunks/_revise-sdk-lazy-harfbuzz-X8gnYTZL.js +1 -0
- package/chunks/ar-kgSWdrXF.js +8 -0
- package/chunks/backend-Cq-khfdG.js +1 -0
- package/chunks/base64-CfDUyGi8.js +36 -0
- package/chunks/browser-module-6b2Fq-5C.js +3 -0
- package/chunks/browser-module-CFmqfGkE.js +3 -0
- package/chunks/browser-module-CkO57IPL.js +3 -0
- package/chunks/bundle.min-DRpfgV69.js +8 -0
- package/chunks/capture-DU3MC7tb.js +1 -0
- package/chunks/carrier-WgcRSu7a.js +1 -0
- package/chunks/de-C2QTHrqo.js +8 -0
- package/chunks/es-BKboUn4q.js +8 -0
- package/chunks/footnoteFlatten-CW-DUcgK.js +1 -0
- package/chunks/graftExport-CVg7PO2A.js +2 -0
- package/chunks/html2canvas.esm-CntiHiYW.js +5 -0
- package/chunks/index-BWdRWxoH.js +24 -0
- package/chunks/index-CLw_BlSL.js +353 -0
- package/chunks/index-F-kHIwWT.js +353 -0
- package/chunks/index.es-CI0QPo8w.js +5 -0
- package/chunks/index.es-DOqegDGr.js +5 -0
- package/chunks/index.es-tXDO0RMv.js +5 -0
- package/chunks/jspdf.es.min-CzYti8jo.js +77 -0
- package/chunks/jspdf.es.min-DU74zN8b.js +77 -0
- package/chunks/jspdf.es.min-ejWOGhkJ.js +77 -0
- package/chunks/jszip.min-CPW0h1Kx.js +2 -0
- package/chunks/katex-DWj8TvwO.js +261 -0
- package/chunks/pdf-BLWDCiFF.js +12 -0
- package/chunks/persistInlineDocumentImages-DQj2iaqg.js +1 -0
- package/chunks/pseudoLocale-CdBtPHRi.js +1 -0
- package/chunks/pseudoLocale-DEVWLkGC.js +1 -0
- package/chunks/purify.es-BwLardii.js +2 -0
- package/chunks/serverDocumentSession-DZrYbdpk.js +42 -0
- package/chunks/tree-sitter-D6zWWUMP.js +4 -0
- package/chunks/wasmInline.generated-CBYFkdSM.js +1 -0
- package/chunks/web-tree-sitter-BXGZGnNj.js +1 -0
- package/full.js +1 -0
- package/index.d.ts +929 -0
- package/index.js +1 -0
- package/package.json +93 -26
- package/root.d.ts +5 -0
- package/root.js +2 -0
- package/serverToolContract.d.ts +373 -0
- package/serverToolInputs.generated.d.ts +229 -0
- package/style.css +1 -0
- package/.npmignore +0 -4
- package/.travis.yml +0 -16
- package/revise.js +0 -16
- package/t/cover +0 -18
- package/t/revise/comparator.t.js +0 -31
- package/t/revise/extractor.t.js +0 -29
- package/t/test +0 -20
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as jr,e as wn,c as xn}from"./MathRenderer-B0Y1h1JU.js";import{bF as Lr}from"./backend-Cq-khfdG.js";const Fr={js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",tsx:"tsx",mts:"typescript",cts:"typescript",py:"python",python3:"python",py3:"python","c++":"cpp",cxx:"cpp",cc:"cpp",hpp:"cpp",h:"c",cs:"c_sharp",csharp:"c_sharp","c#":"c_sharp",golang:"go",rs:"rust",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",htm:"html",yml:"yaml",kt:"kotlin",kts:"kotlin",ex:"elixir",exs:"elixir",sol:"solidity",ml:"ocaml",mli:"ocaml",plaintext:"text",plain:"text",txt:"text"},_n=new Set(["javascript","typescript","tsx","python","java","c","cpp","c_sharp","go","rust","ruby","php","swift","kotlin","scala","bash","css","html","json","yaml","toml","lua","elixir","dart","vue","zig","elm","solidity","ocaml"]);function Ut(t){const e=t.toLowerCase().trim();if(Fr[e]){const n=Fr[e];return n==="text"?null:n}return _n.has(e)?e:null}const $e={keyword:"#0000FF",string:"#A31515",number:"#098658",comment:"#008000",function:"#795E26",variable:"#001080",operator:"#000000",punctuation:"#000000",type:"#267F99",property:"#001080",constant:"#0070C1",default:"#000000",background:"#ffffff",text:"#000000"};let kt=null,Jt=new Map,Vt=new Map,wt=new Set,Er=!1;function Bn(t){return typeof t=="object"&&t!==null&&"status"in t&&t.status===404?!0:(t instanceof Error?t.message:typeof t=="string"?t:"").includes("status 404")}function Cn(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e^t.charCodeAt(n);return(e>>>0).toString(36)}function Mn(t,e){return["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","try","catch","finally","throw","new","delete","typeof","instanceof","void","in","of","class","extends","static","get","set","async","await","yield","import","export","from","as","default","this","super"].includes(t)?"keyword":["string","template_string","string_fragment","template_literal"].includes(t)?"string":["number","integer","float"].includes(t)?"number":["comment","line_comment","block_comment"].includes(t)?"comment":t==="identifier"&&(e==="function_declaration"||e==="call_expression"||e==="method_definition")?"function":["type_identifier","predefined_type","type_annotation"].includes(t)?"type":t==="property_identifier"||e==="member_expression"?"property":["true","false","null","undefined"].includes(t)?"constant":["+","-","*","/","%","=","==","===","!=","!==","<",">","<=",">=","&&","||","!","&","|","^","~","<<",">>",">>>","++","--","+=","-=","*=","/=","?",":","=>"].includes(t)?"operator":["(",")","{","}","[","]",";",",",".","..."].includes(t)?"punctuation":t==="identifier"?"variable":"default"}function Pe(){return typeof window>"u"||globalThis.__reviseServerRuntime===!0}async function qr(){if(kt)return kt;const t=(async()=>{const e=(await import("./web-tree-sitter-BXGZGnNj.js")).Parser;await e.init({locateFile:r=>jr(`tree-sitter/${r}`)});const n=new e;return Er=!0,n})();return t.catch(()=>{kt===t&&(kt=null)}),kt=t,t}async function Nr(t){if(Jt.has(t))return Jt.get(t);if(wt.has(t))return null;if(Vt.has(t))return Vt.get(t);const e=(async()=>{try{const n=await(await import("./web-tree-sitter-BXGZGnNj.js")).Language.load(jr(`tree-sitter/tree-sitter-${t}.wasm`));return Jt.set(t,n),n}catch(n){return Bn(n)?(wt.add(t),console.warn(`Tree-sitter grammar not found for ${t} (404). Disabling syntax highlighting for this language.`),null):(console.warn(`Failed to load tree-sitter grammar for ${t}:`,n),null)}finally{Vt.delete(t)}})();return Vt.set(t,e),e}function Dr(t,e){if(t.childCount===0)e.push({start:t.startIndex,end:t.endIndex,type:t.type,parentType:t.parent?.type});else for(let n=0;n<t.childCount;n++)Dr(t.child(n),e)}function Sn(t="javascript"){const e=Ut(t);return e?Er&&Jt.has(e):!0}async function In(t="javascript"){if(Pe())return!1;const e=Ut(t);if(!e)return!0;if(wt.has(e))return!1;try{const n=await qr(),r=await Nr(e);return r?(n.setLanguage(r),!0):!1}catch(n){return console.warn("Failed to preload syntax highlighter:",n),!1}}async function Re(t,e="javascript",n=$e){if(Pe())return null;const r=Ut(e);if(!r||wt.has(r))return null;try{const a=await qr(),o=await Nr(r);if(!o)return null;a.setLanguage(o);const l=a.parse(t),s=[];Dr(l.rootNode,s),s.sort((h,N)=>h.start-N.start);const f=[];let m=0;for(const h of s){if(h.start>m){const w=t.slice(m,h.start);w&&f.push({text:w,color:n.default})}const N=t.slice(h.start,h.end);if(N){const w=Mn(h.type,h.parentType);f.push({text:N,color:n[w]})}m=h.end}return m<t.length&&f.push({text:t.slice(m),color:n.default}),f}catch(a){return console.warn("Syntax highlighting failed:",a),null}}let lt=new Map;const jn=100;function Ln(t,e="javascript",n){if(Pe())return null;const r=Ut(e);if(!r||wt.has(r))return null;const a=n||$e,o=a.keyword+a.string,l=`${r}:${o}:${Cn(t)}`;if(lt.has(l))return lt.get(l);const s=(f,m)=>{if(lt.size>=jn){const h=lt.keys().next().value;h&<.delete(h)}lt.set(f,m)};return Sn(r)?(Re(t,r,a).then(f=>{f&&s(l,f)}),null):(Re(t,r,a).then(f=>{f&&(s(l,f),typeof window<"u"&&window.dispatchEvent(new CustomEvent("syntax-highlight-ready")))}),null)}const xt=180,ze=new Map,Qt=new Map,Tr=new Map,$r=new Map,Fn=new Set,U=new Map;let Ae=null,Pr=0;function Q(t){return t.trim().toLowerCase()}function Rr(t){return[t.background,t.text,t.selection,t.pageBorder,t.pageBackground,t.codeBackground,t.codeBorder,t.codeText,t.diffInsert,t.diffDelete].join("|")}function Oe(t){const e=Q(t.protocol),n=Math.max(120,Math.round(t.maxWidth));return`${e}:${n}:${Rr(t.theme)}:${t.source}`}function Kt(t){const e=Q(t.protocol),n=Math.max(120,Math.round(t.maxWidth));return`${e}:${n}:${Rr(t.theme)}`}function zr(t){const e=Kt(t);return Tr.get(e)||{width:Math.max(120,Math.round(t.maxWidth)),height:xt}}function We(t){return t.replace(/\s+/g," ").trim()}function En(t){if(t instanceof Error&&t.message)return We(t.message);if(typeof t=="string"&&t.trim())return We(t);if(t&&typeof t=="object"){const e=t,n=typeof e.message=="string"&&e.message||typeof e.str=="string"&&e.str||"",r=typeof e.hash=="object"&&e.hash?e.hash:null,a=r&&typeof r.line=="number"&&Number.isFinite(r.line)?r.line+1:null,o=r&&typeof r.loc=="object"&&r.loc?r.loc:null,l=o&&typeof o.first_column=="number"&&Number.isFinite(o.first_column)?o.first_column+1:null,s=a!==null?`Line ${a}${l!==null?`, col ${l}`:""}: `:"";if(n.trim())return`${s}${We(n)}`}return"Diagram render failed"}function qn(t,e,n){if(e<=0||n<=0||!Number.isFinite(e)||!Number.isFinite(n))return;const r=Kt(t);Tr.set(r,{width:Math.max(1,Math.round(e)),height:Math.max(1,Math.round(n))})}function Nn(t,e){if(!e.image||e.width<=0||e.height<=0)return;const n=Kt(t);$r.set(n,{image:e.image,svg:e.svg,width:Math.max(1,Math.round(e.width)),height:Math.max(1,Math.round(e.height))})}function Dn(){typeof window<"u"&&window.dispatchEvent(new CustomEvent("diagram-render-ready"));for(const t of Fn)try{t()}catch(e){console.error("diagram render callback failed:",e)}}function Tn(t){if(typeof DOMParser<"u")try{const n=new DOMParser().parseFromString(t,"image/svg+xml").documentElement,r=n.getAttribute("viewBox");if(r){const l=r.split(/\s+/).map(s=>Number.parseFloat(s)).filter(s=>Number.isFinite(s));if(l.length===4&&l[2]>0&&l[3]>0)return{width:l[2],height:l[3]}}const a=n.getAttribute("width"),o=n.getAttribute("height");if(a&&o){const l=Number.parseFloat(a),s=Number.parseFloat(o);if(Number.isFinite(l)&&Number.isFinite(s))return{width:l,height:s}}}catch{}const e=t.match(/viewBox="([^"]+)"/i);if(e){const n=e[1].split(/\s+/).map(r=>Number.parseFloat(r)).filter(r=>Number.isFinite(r));if(n.length===4&&n[2]>0&&n[3]>0)return{width:n[2],height:n[3]}}return{width:800,height:xt}}function $n(t,e,n){if(t<=0||e<=0)return{width:n,height:xt};if(t<=n)return{width:t,height:e};const r=n/t;return{width:n,height:Math.max(40,Math.round(e*r))}}async function Pn(t,e,n){const r="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(t),a=new Image;return new Promise((o,l)=>{a.onload=()=>{o(a)},a.onerror=()=>{l(new Error("Failed to load rendered diagram SVG"))},a.src=r,a.width=Math.max(1,Math.round(e)),a.height=Math.max(1,Math.round(n))})}function Rn(t){const e=Math.max(1,t.naturalWidth||t.width||1),n=Math.max(1,t.naturalHeight||t.height||1),r=document.createElement("canvas");r.width=e,r.height=n;const a=r.getContext("2d");if(!a)throw new Error("Unable to create PNG export canvas");return a.drawImage(t,0,0,e,n),r.toDataURL("image/png")}async function zn(){if(typeof window>"u")throw new Error("Mermaid runtime requires a browser environment");return window.mermaid?window.mermaid:(Ae||(Ae=new Promise((t,e)=>{const n=document.querySelector('script[data-revise-mermaid="true"]');if(n){n.addEventListener("load",()=>t(window.mermaid)),n.addEventListener("error",()=>e(new Error("Failed to load Mermaid script")));return}const r=document.createElement("script");r.src="https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.min.js",r.async=!0,r.defer=!0,r.setAttribute("data-revise-mermaid","true"),r.onload=()=>t(window.mermaid),r.onerror=()=>e(new Error("Failed to load Mermaid script")),document.head.appendChild(r)})),Ae)}function An(t){return{background:t.pageBackground,primaryColor:t.codeBackground,primaryBorderColor:t.codeBorder,primaryTextColor:t.codeText,secondaryColor:t.background,secondaryBorderColor:t.pageBorder,tertiaryColor:t.background,tertiaryBorderColor:t.pageBorder,lineColor:t.text,arrowheadColor:t.text,defaultLinkColor:t.text,textColor:t.text,edgeLabelBackground:t.pageBackground,clusterBkg:t.codeBackground,clusterBorder:t.pageBorder,nodeBorder:t.codeBorder,fontFamily:"Arial, sans-serif",cScale0:t.codeBackground,cScale1:t.background,cScale2:t.pageBackground,cScaleLabel0:t.text,cScaleLabel1:t.text,cScaleLabel2:t.text}}function Ar(t){if(typeof document>"u")return;const e=document.getElementById(t);e?.parentElement&&e.parentElement.removeChild(e)}const On={protocol:"mermaid",renderToSvg:async(t,e)=>{const n=await zn();if(!n)throw new Error("Mermaid runtime unavailable");n.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:"base",themeVariables:An(e)}),Pr+=1;const r=`revise-mermaid-${Pr}`;Ar(r);let a;try{a=await n.render(r,t)}finally{Ar(r)}const o=typeof a=="string"?a:a?.svg;if(!o||typeof o!="string")throw new Error("Mermaid returned invalid SVG output");const l=Tn(o);return{svg:o,width:l.width,height:l.height}}};function Or(t,e){return{protocol:t,renderToSvg:async(n,r)=>{const a=n.trim();if(!a)throw new Error("LaTeX source is empty");await wn(a,e,r.text);const o=xn(a,e,r.text);if(!o?.svg)throw new Error("LaTeX render unavailable");return{svg:o.svg,width:o.width,height:o.height}}}}function Wr(){U.has("mermaid")||U.set("mermaid",On),U.has("latex")||U.set("latex",Or("latex",!0)),U.has("latex-inline")||U.set("latex-inline",Or("latex-inline",!1))}async function Wn(t){Wr();const e=Q(t.protocol),n=U.get(e);if(!n)return{image:null,width:t.maxWidth,height:xt,loading:!1,error:`Unsupported diagram protocol: ${t.protocol}`};try{const{svg:r,width:a,height:o}=await n.renderToSvg(t.source,t.theme),l=$n(a,o,t.maxWidth);qn(t,l.width,l.height);const s={image:await Pn(r,l.width,l.height),svg:r,width:l.width,height:l.height,loading:!1};return Nn(t,s),s}catch(r){const a=zr(t);return{image:null,width:a.width,height:a.height,loading:!1,error:En(r)}}}function Xr(t){if(!t)return null;Wr();const e=Q(t);return U.has(e)?e:null}function Xe(t){const e=Q(t.protocol);if(!e||!t.source.trim())return{image:null,width:t.maxWidth,height:xt,loading:!1,error:"Diagram source is empty"};const n={...t,protocol:e,source:t.source},r=Oe(n),a=ze.get(r);if(a)return a;if(!Qt.has(r)){const f=Wn(n).then(m=>(ze.set(r,m),Qt.delete(r),Dn(),m));Qt.set(r,f)}const o=Kt(n),l=$r.get(o);if(l)return{image:l.image,svg:l.svg,width:l.width,height:l.height,loading:!0};const s=zr(n);return{image:null,width:s.width,height:s.height,loading:!0}}async function Gr(t){const e=Xe(t);if(!e.loading)return e;const n=Oe({...t,protocol:Q(t.protocol)});return Qt.get(n)||Xe(t)}function Zr(t){const e=Oe({...t,protocol:Q(t.protocol)}),n=ze.get(e);return!n||n.loading?null:n}function Xn(t){const e=Zr(t);return!e||!e.svg?null:{svg:e.svg,width:e.width,height:e.height}}function Gn(t){if(typeof document>"u")return null;const e=Zr(t);if(!e||!e.image)return null;try{return{dataUrl:Rn(e.image),width:e.width,height:e.height}}catch{return null}}async function Zn(t,e,n){const r=[],a=o=>{if(!(!o||typeof o!="object")){if(o.type==="code"){const l=Xr(o.language);l&&o.renderDiagram!==!1&&o.content?.trim()&&r.push({protocol:l,source:o.content,theme:e,maxWidth:n});return}if(o.type==="container"||o.type==="table-cell"){for(const l of o.children||[])a(l);return}if(o.type==="table")for(const l of o.children||[])for(const s of l.children||[])for(const f of s.children||[])a(f)}};for(const o of t.children)a(o);r.length!==0&&await Promise.all(r.map(o=>Gr(o)))}const Hr={isDark:!1,background:"#f5f5f5",text:"#000000",linkText:"#007bff",selection:"#3390ff",selectionOpacity:.4,inactiveSelection:"#9ac0e8",inactiveSelectionOpacity:.35,agentReadHighlight:"#7aaee6",searchHighlight:"#cc8f00",cursor:"#000000",pageBorder:"#dee2e6",pageBackground:"#ffffff",pageShadow:"rgba(0, 0, 0, 0.1)",diffInsert:"#22c55e",diffDelete:"#CF2A2A",diffEqual:"#000000",diffFormatChange:"#f59e0b",diffInsertText:"#0B8237",diffDeleteText:"#CF2A2A",diffFormatChangeText:"#78350f",debugText:"#ff0000",todoCheckboxBorder:"#c8ccd5",todoCheckboxBackground:"#ffffff",todoCheckboxChecked:"#46b35e",todoCheckboxCheckmark:"#46b35e",todoCheckedText:"#6c757d",codeBackground:"#f5f5f5",codeBorder:"#e0e0e0",codeText:"#333333"},Hn={isDark:!0,background:"#080a0e",text:"#c9c9c9",linkText:"#4099ff",selection:"#4099ff",selectionOpacity:.4,inactiveSelection:"#5a7a9e",inactiveSelectionOpacity:.35,agentReadHighlight:"#24568f",searchHighlight:"#fbbf24",cursor:"#ffffff",pageBorder:"#1e2430",pageBackground:"#05060a",pageShadow:"rgba(0, 0, 0, 0.5)",diffInsert:"#50B173",diffDelete:"#f87171",diffEqual:"#c9c9c9",diffFormatChange:"#fbbf24",diffInsertText:"#50B173",diffDeleteText:"#f87171",diffFormatChangeText:"#f5a91d",debugText:"#ff6b6b",todoCheckboxBorder:"#2f3747",todoCheckboxBackground:"#05060a",todoCheckboxChecked:"#0e6b30",todoCheckboxCheckmark:"#f3f7ff",todoCheckedText:"#6f7689",codeBackground:"#0c0f15",codeBorder:"#2a2f3a",codeText:"#c9c9c9"};function Un(t){if(typeof window>"u")return!1;const e=t?.closest?.("[data-theme]")?.getAttribute("data-theme");return e==="dark"?!0:e==="light"?!1:document.documentElement.classList.contains("dark")||document.documentElement.classList.contains("dark-theme")}function Ur(t){const e=Un(t)?Hn:Hr,n=t?.closest?.("[data-page-background]")?.getAttribute("data-page-background");return n?{...e,pageBackground:n}:e}function Jn(t,e){const n=parseInt(t.slice(1,3),16),r=parseInt(t.slice(3,5),16),a=parseInt(t.slice(5,7),16);return`rgba(${n}, ${r}, ${a}, ${e})`}const Jr=["bold","italic","underline","strikethrough","doubleStrikethrough","smallCaps","allCaps","letterSpacing","code","latex","superscript","subscript","backgroundColor","link"],Vn=Jr.reduce((t,e)=>(t[e]=null,t),{}),Qn=[],Ge={yellow:"#FDE68A",orange:"#FED7AA",green:"#BBF7D0",blue:"#BFDBFE",purple:"#E9D5FF",pink:"#FBCFE8",gray:"#E5E7EB"},Kn={yellow:"#7C5E10",orange:"#7C3F16",green:"#1F5F3A",blue:"#1E4E8C",purple:"#5B3A7A",pink:"#7A3F66",gray:"#4B5563"},Vr=Ge,Qr=["yellow","orange","green","blue","purple","pink","gray"],Yn={yellow:"yellow",gold:"yellow",orange:"orange",darkorange:"orange",darkyellow:"orange",green:"green",darkgreen:"green",blue:"blue",cyan:"blue",darkblue:"blue",darkcyan:"blue",purple:"purple",violet:"purple",darkviolet:"purple",darkmagenta:"purple",pink:"pink",magenta:"pink",red:"pink",darkred:"pink",gray:"gray",grey:"gray",lightgray:"gray",lightgrey:"gray",darkgray:"gray",darkgrey:"gray",black:"gray",white:"gray"},ta={yellow:"yellow",gold:"yellow",orange:"orange",green:"green",blue:"blue",cyan:"blue",purple:"purple",violet:"purple",pink:"pink",magenta:"pink",red:"pink",gray:"gray",grey:"gray",lightgray:"gray",lightgrey:"gray"},ea="yellow";function ra(t){if(!t)return;const e=t.trim().toLowerCase().replace(/[\s_-]+/g,"");return Yn[e]}function na(t){return Yt(t)}function aa(t){const e=Yt(t);return e?Vr[e]:void 0}function oa(t,e=Ur().isDark){const n=Yt(t);return n?(e?Kn:Ge)[n]:void 0}function Kr(t){const e=Lr(t);return e?[e.r,e.g,e.b]:null}function ia(t){const e=Lr(t);return e?{rgb:[e.r,e.g,e.b],alpha:e.a}:null}function Yr(t,e=!1,n=Qr){let r=null,a=Number.POSITIVE_INFINITY;for(const o of n){const l=[Vr[o],...e?[Ge[o]]:[]];for(const s of l){const f=Kr(s);if(!f)continue;const m=(t[0]-f[0])**2+(t[1]-f[1])**2+(t[2]-f[2])**2;m<a&&(a=m,r=o)}}return r?{name:r,distance:a}:null}function la(t){const[e,n,r]=t.map(h=>h/255),a=Math.max(e,n,r),o=Math.min(e,n,r),l=a-o,s=(a+o)/2,f=l===0?0:l/(1-Math.abs(2*s-1));let m=null;return l!==0&&(a===e?m=60*((n-r)/l%6):a===n?m=60*((r-e)/l+2):m=60*((e-n)/l+4),m<0&&(m+=360)),{hue:m,lightness:s,saturation:f,maxChannel:Math.max(...t)}}function sa(t){return t>=20&&t<42?"orange":t>=42&&t<85?"yellow":t>=85&&t<170?"green":t>=170&&t<255?"blue":t>=255&&t<320?"purple":"pink"}function ca(t){if(!t)return;const e=t.trim().toLowerCase().replace(/[\s_-]+/g,"");return ta[e]}function Yt(t){if(!t)return;const e=ra(t);if(e)return e;if(/^[a-z]+$/i.test(t.trim()))return;const n=Kr(t);if(n)return Yr(n)?.name}function fa(t){if(!t)return;const e=ca(t);if(e)return e;const n=ia(t);if(!n||n.alpha<.35)return;const{hue:r,lightness:a,saturation:o,maxChannel:l}=la(n.rgb),s=o>.18&&r!==null?[sa(r)]:["gray"],f=Yr(n.rgb,!0,s);if(!f)return;if(f.distance===0)return f.name;if(f.name==="gray")return f.distance>70**2||o>.12||a<.68||a>.92?void 0:f.name;const m=o>=.8&&l>=220&&a>=.45;if(!(f.distance>95**2&&!m)&&!(a>.92)&&!(l<150)&&!(o<.22)&&!(a<.55&&l<220))return f.name}const O={paragraph:16,h1:32,h2:24,h3:20,h4:18,h5:16,h6:14,code:14},te={paragraph:1.4,heading:1.2,code:1.5};function tn(t){if(!t.hasOwnProperty("heading"))return O.paragraph;switch(t.heading){case 1:return O.h1;case 2:return O.h2;case 3:return O.h3;case 4:return O.h4;case 5:return O.h5;case 6:return O.h6;default:return O.paragraph}}function en(t){return t.lineSpacing!==void 0?t.lineSpacing:t.heading?te.heading:te.paragraph}function ua(t){const e=tn(t),n=en(t);return e*n}function da(t){return t.lineSpacing!==void 0?t.lineSpacing:te.paragraph}function ha(){var t=function(e){var n={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},a={};r.L=1,a[1]="L",Object.keys(n).forEach(function(u,k){r[u]=1<<k+1,a[r[u]]=u}),Object.freeze(r);var o=r.LRI|r.RLI|r.FSI,l=r.L|r.R|r.AL,s=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,f=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,m=r.S|r.WS|r.B|o|r.PDI|f,h=null;function N(){if(!h){h=new Map;var u=function(y){if(n.hasOwnProperty(y)){var i=0;n[y].split(",").forEach(function(_){var d=_.split("+"),p=d[0],g=d[1];p=parseInt(p,36),g=g?parseInt(g,36):0,h.set(i+=p,r[y]);for(var C=0;C<g;C++)h.set(++i,r[y])})}};for(var k in n)u(k)}}function w(u){return N(),h.get(u.codePointAt(0))||r.L}function K(u){return a[w(u)]}var Ct={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function re(u,k){var y=36,i=0,_=new Map,d=k&&new Map,p;return u.split(",").forEach(function g(C){if(C.indexOf("+")!==-1)for(var M=+C;M--;)g(p);else{p=C;var v=C.split(">"),B=v[0],P=v[1];B=String.fromCodePoint(i+=parseInt(B,y)),P=String.fromCodePoint(i+=parseInt(P,y)),_.set(B,P),k&&d.set(P,B)}}),{map:_,reverseMap:d}}var ne,He,Ue;function ae(){if(!ne){var u=re(Ct.pairs,!0),k=u.map,y=u.reverseMap;ne=k,He=y,Ue=re(Ct.canonical,!1).map}}function oe(u){return ae(),ne.get(u)||null}function ie(u){return ae(),He.get(u)||null}function le(u){return ae(),Ue.get(u)||null}var E=r.L,D=r.R,j=r.EN,st=r.ES,Mt=r.ET,ct=r.AN,St=r.CS,Y=r.B,an=r.S,It=r.ON,on=r.BN,jt=r.NSM,Lt=r.AL,Je=r.LRO,Ft=r.RLO,Ve=r.LRE,se=r.RLE,Qe=r.PDF,ln=r.LRI,Ke=r.RLI,sn=r.FSI,tt=r.PDI;function cn(u,k){for(var y=125,i=new Uint32Array(u.length),_=0;_<u.length;_++)i[_]=w(u[_]);var d=new Map;function p(L,$){var F=i[L];i[L]=$,d.set(F,d.get(F)-1),F&s&&d.set(s,d.get(s)-1),d.set($,(d.get($)||0)+1),$&s&&d.set(s,(d.get(s)||0)+1)}for(var g=new Uint8Array(u.length),C=new Map,M=[],v=null,B=0;B<u.length;B++)v||M.push(v={start:B,end:u.length-1,level:k==="rtl"?1:k==="ltr"?0:Sr(B,!1)}),i[B]&Y&&(v.end=B,v=null);for(var P=se|Ve|Ft|Je|o|tt|Qe|Y,J=function(L){return L+(L&1?1:2)},W=function(L){return L+(L&1?2:1)},X=0;X<M.length;X++){v=M[X];var b=[{_level:v.level,_override:0,_isolate:0}],x=void 0,A=0,G=0,ue=0;d.clear();for(var S=v.start;S<=v.end;S++){var I=i[S];if(x=b[b.length-1],d.set(I,(d.get(I)||0)+1),I&s&&d.set(s,(d.get(s)||0)+1),I&P)if(I&(se|Ve)){g[S]=x._level;var er=(I===se?W:J)(x._level);er<=y&&!A&&!G?b.push({_level:er,_override:0,_isolate:0}):A||G++}else if(I&(Ft|Je)){g[S]=x._level;var rr=(I===Ft?W:J)(x._level);rr<=y&&!A&&!G?b.push({_level:rr,_override:I&Ft?D:E,_isolate:0}):A||G++}else if(I&o){I&sn&&(I=Sr(S+1,!0)===1?Ke:ln),g[S]=x._level,x._override&&p(S,x._override);var nr=(I===Ke?W:J)(x._level);nr<=y&&A===0&&G===0?(ue++,b.push({_level:nr,_override:0,_isolate:1,_isolInitIndex:S})):A++}else if(I&tt){if(A>0)A--;else if(ue>0){for(G=0;!b[b.length-1]._isolate;)b.pop();var de=b[b.length-1]._isolInitIndex;de!=null&&(C.set(de,S),C.set(S,de)),b.pop(),ue--}x=b[b.length-1],g[S]=x._level,x._override&&p(S,x._override)}else I&Qe?(A===0&&(G>0?G--:!x._isolate&&b.length>1&&(b.pop(),x=b[b.length-1])),g[S]=x._level):I&Y&&(g[S]=v.level);else g[S]=x._level,x._override&&I!==on&&p(S,x._override)}for(var et=[],R=null,V=v.start;V<=v.end;V++){var he=i[V];if(!(he&f)){var ar=g[V],or=he&o,gn=he===tt;R&&ar===R._level?(R._end=V,R._endsWithIsolInit=or):et.push(R={_start:V,_end:V,_level:ar,_startsWithPDI:gn,_endsWithIsolInit:or})}}for(var ge=[],Et=0;Et<et.length;Et++){var qt=et[Et];if(!qt._startsWithPDI||qt._startsWithPDI&&!C.has(qt._start)){for(var pe=[R=qt],ir=void 0;R&&R._endsWithIsolInit&&(ir=C.get(R._end))!=null;)for(var Nt=Et+1;Nt<et.length;Nt++)if(et[Nt]._start===ir){pe.push(R=et[Nt]);break}for(var rt=[],me=0;me<pe.length;me++)for(var lr=pe[me],ve=lr._start;ve<=lr._end;ve++)rt.push(ve);for(var pn=g[rt[0]],sr=v.level,Dt=rt[0]-1;Dt>=0;Dt--)if(!(i[Dt]&f)){sr=g[Dt];break}var ye=rt[rt.length-1],mn=g[ye],cr=v.level;if(!(i[ye]&o)){for(var Tt=ye+1;Tt<=v.end;Tt++)if(!(i[Tt]&f)){cr=g[Tt];break}}ge.push({_seqIndices:rt,_sosType:Math.max(sr,pn)%2?D:E,_eosType:Math.max(cr,mn)%2?D:E})}}for(var be=0;be<ge.length;be++){var ke=ge[be],c=ke._seqIndices,ft=ke._sosType,vn=ke._eosType,nt=g[c[0]]&1?D:E;if(d.get(jt))for(var $t=0;$t<c.length;$t++){var fr=c[$t];if(i[fr]&jt){for(var we=ft,Pt=$t-1;Pt>=0;Pt--)if(!(i[c[Pt]]&f)){we=i[c[Pt]];break}p(fr,we&(o|tt)?It:we)}}if(d.get(j))for(var Rt=0;Rt<c.length;Rt++){var ur=c[Rt];if(i[ur]&j)for(var zt=Rt-1;zt>=-1;zt--){var dr=zt===-1?ft:i[c[zt]];if(dr&l){dr===Lt&&p(ur,ct);break}}}if(d.get(Lt))for(var xe=0;xe<c.length;xe++){var hr=c[xe];i[hr]&Lt&&p(hr,D)}if(d.get(st)||d.get(St))for(var ut=1;ut<c.length-1;ut++){var _e=c[ut];if(i[_e]&(st|St)){for(var at=0,Be=0,Ce=ut-1;Ce>=0&&(at=i[c[Ce]],!!(at&f));Ce--);for(var Me=ut+1;Me<c.length&&(Be=i[c[Me]],!!(Be&f));Me++);at===Be&&(i[_e]===st?at===j:at&(j|ct))&&p(_e,at)}}if(d.get(j))for(var z=0;z<c.length;z++){var yn=c[z];if(i[yn]&j){for(var At=z-1;At>=0&&i[c[At]]&(Mt|f);At--)p(c[At],j);for(z++;z<c.length&&i[c[z]]&(Mt|f|j);z++)i[c[z]]!==j&&p(c[z],j)}}if(d.get(Mt)||d.get(st)||d.get(St))for(var dt=0;dt<c.length;dt++){var gr=c[dt];if(i[gr]&(Mt|st|St)){p(gr,It);for(var Ot=dt-1;Ot>=0&&i[c[Ot]]&f;Ot--)p(c[Ot],It);for(var Wt=dt+1;Wt<c.length&&i[c[Wt]]&f;Wt++)p(c[Wt],It)}}if(d.get(j))for(var Se=0,pr=ft;Se<c.length;Se++){var mr=c[Se],Ie=i[mr];Ie&j?pr===E&&p(mr,E):Ie&l&&(pr=Ie)}if(d.get(s)){var ht=D|j|ct,vr=ht|E,Xt=[];{for(var ot=[],it=0;it<c.length;it++)if(i[c[it]]&s){var gt=u[c[it]],yr=void 0;if(oe(gt)!==null)if(ot.length<63)ot.push({char:gt,seqIndex:it});else break;else if((yr=ie(gt))!==null)for(var pt=ot.length-1;pt>=0;pt--){var je=ot[pt].char;if(je===yr||je===ie(le(gt))||oe(le(je))===gt){Xt.push([ot[pt].seqIndex,it]),ot.length=pt;break}}}Xt.sort(function(L,$){return L[0]-$[0]})}for(var Le=0;Le<Xt.length;Le++){for(var br=Xt[Le],Gt=br[0],Fe=br[1],kr=!1,T=0,Ee=Gt+1;Ee<Fe;Ee++){var wr=c[Ee];if(i[wr]&vr){kr=!0;var xr=i[wr]&ht?D:E;if(xr===nt){T=xr;break}}}if(kr&&!T){T=ft;for(var qe=Gt-1;qe>=0;qe--){var _r=c[qe];if(i[_r]&vr){var Br=i[_r]&ht?D:E;Br!==nt?T=Br:T=nt;break}}}if(T){if(i[c[Gt]]=i[c[Fe]]=T,T!==nt){for(var mt=Gt+1;mt<c.length;mt++)if(!(i[c[mt]]&f)){w(u[c[mt]])&jt&&(i[c[mt]]=T);break}}if(T!==nt){for(var vt=Fe+1;vt<c.length;vt++)if(!(i[c[vt]]&f)){w(u[c[vt]])&jt&&(i[c[vt]]=T);break}}}}for(var Z=0;Z<c.length;Z++)if(i[c[Z]]&s){for(var Cr=Z,Ne=Z,De=ft,yt=Z-1;yt>=0;yt--)if(i[c[yt]]&f)Cr=yt;else{De=i[c[yt]]&ht?D:E;break}for(var Mr=vn,bt=Z+1;bt<c.length;bt++)if(i[c[bt]]&(s|f))Ne=bt;else{Mr=i[c[bt]]&ht?D:E;break}for(var Te=Cr;Te<=Ne;Te++)i[c[Te]]=De===Mr?De:nt;Z=Ne}}}for(var q=v.start;q<=v.end;q++){var bn=g[q],Zt=i[q];if(bn&1?Zt&(E|j|ct)&&g[q]++:Zt&D?g[q]++:Zt&(ct|j)&&(g[q]+=2),Zt&f&&(g[q]=q===0?v.level:g[q-1]),q===v.end||w(u[q])&(an|Y))for(var Ht=q;Ht>=0&&w(u[Ht])&m;Ht--)g[Ht]=v.level}}return{levels:g,paragraphs:M};function Sr(L,$){for(var F=L;F<u.length;F++){var H=i[F];if(H&(D|Lt))return 1;if(H&(Y|E)||$&&H===tt)return 0;if(H&o){var Ir=kn(F);F=Ir===-1?u.length:Ir}}return 0}function kn(L){for(var $=1,F=L+1;F<u.length;F++){var H=i[F];if(H&Y)break;if(H&tt){if(--$===0)return F}else H&o&&$++}return-1}}var fn="14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",ce;function un(){if(!ce){var u=re(fn,!0),k=u.map,y=u.reverseMap;y.forEach(function(i,_){k.set(_,i)}),ce=k}}function fe(u){return un(),ce.get(u)||null}function dn(u,k,y,i){var _=u.length;y=Math.max(0,y==null?0:+y),i=Math.min(_-1,i==null?_-1:+i);for(var d=new Map,p=y;p<=i;p++)if(k[p]&1){var g=fe(u[p]);g!==null&&d.set(p,g)}return d}function Ye(u,k,y,i){var _=u.length;y=Math.max(0,y==null?0:+y),i=Math.min(_-1,i==null?_-1:+i);var d=[];return k.paragraphs.forEach(function(p){var g=Math.max(y,p.start),C=Math.min(i,p.end);if(g<C){for(var M=k.levels.slice(g,C+1),v=C;v>=g&&w(u[v])&m;v--)M[v]=p.level;for(var B=p.level,P=1/0,J=0;J<M.length;J++){var W=M[J];W>B&&(B=W),W<P&&(P=W|1)}for(var X=B;X>=P;X--)for(var b=0;b<M.length;b++)if(M[b]>=X){for(var x=b;b+1<M.length&&M[b+1]>=X;)b++;b>x&&d.push([x+g,b+g])}}}),d}function hn(u,k,y,i){var _=tr(u,k,y,i),d=[].concat(u);return _.forEach(function(p,g){d[g]=(k.levels[p]&1?fe(u[p]):null)||u[p]}),d.join("")}function tr(u,k,y,i){for(var _=Ye(u,k,y,i),d=[],p=0;p<u.length;p++)d[p]=p;return _.forEach(function(g){for(var C=g[0],M=g[1],v=d.slice(C,M+1),B=v.length;B--;)d[M-B]=v[B]}),d}return e.closingToOpeningBracket=ie,e.getBidiCharType=w,e.getBidiCharTypeName=K,e.getCanonicalBracket=le,e.getEmbeddingLevels=cn,e.getMirroredCharacter=fe,e.getMirroredCharactersMap=dn,e.getReorderSegments=Ye,e.getReorderedIndices=tr,e.getReorderedString=hn,e.openingToClosingBracket=oe,Object.defineProperty(e,"__esModule",{value:!0}),e}({});return t}const ga=new Set(["R","AL","AN","RLE","RLO","RLI","LRE","LRO","LRI","FSI","PDI","PDF"]),_t=new Map,pa=500;function rn(t){const e=_t.get(t);if(e!==void 0)return e;let n=!1;for(const r of t)if(ga.has(ee().getBidiCharTypeName(r))){n=!0;break}if(_t.size>=pa){const r=_t.keys().next().value;r!==void 0&&_t.delete(r)}return _t.set(t,n),n}function nn(t){for(let e=0;e<t.length;){const n=t.codePointAt(e);if(n===void 0)break;const r=String.fromCodePoint(n),a=ee().getBidiCharTypeName(r);if(a==="R"||a==="AL")return"rtl";if(a==="L")return"ltr";e+=r.length}return null}function ma(t,e){return t==="rtl"||t==="ltr"?t:nn(e)??"ltr"}let Ze=null;function ee(){return Ze||(Ze=ha()),Ze}const Bt=new Map,va=300;function ya(t,e){const n=e+"\0"+t,r=Bt.get(n);if(r)return r;const a=ee().getEmbeddingLevels(t,e);if(Bt.size>=va){const o=Bt.keys().next().value;o!==void 0&&Bt.delete(o)}return Bt.set(n,a),a}function ba(t,e,n,r){if(r<=n)return[];if(e==="ltr"&&!rn(t.slice(n,r)))return[{start:n,end:r,rtl:!1}];const a=ya(t,e),o=ee().getReorderSegments(t,a,n,r-1),l=r-n,s=new Array(l);for(let h=0;h<l;h++)s[h]=n+h;for(const[h,N]of o){let w=h-n,K=N-n;for(;w<K;){const Ct=s[w];s[w]=s[K],s[K]=Ct,w++,K--}}const f=[];let m=0;for(let h=1;h<=l;h++){if(!(h===l||Math.abs(s[h]-s[h-1])!==1||s[h]-s[h-1]!==s[m+1]-s[m]))continue;const N=s[m],w=s[h-1];N<=w?f.push({start:N,end:w+1,rtl:!1}):f.push({start:w,end:N+1,rtl:!0}),m=h}for(const h of f)h.end-h.start===1&&(h.rtl=(a.levels[h.start]&1)===1);return f}export{Xe as A,In as B,Qn as C,ea as D,O as F,Qr as H,te as L,Vn as a,Jr as b,nn as c,fa as d,Ur as e,Zn as f,Xr as g,Yt as h,aa as i,Xn as j,Ln as k,$e as l,Gn as m,na as n,Hr as o,en as p,Re as q,ma as r,Gr as s,rn as t,tn as u,Jn as v,ba as w,oa as x,ua as y,da as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var cn=Object.defineProperty,ln=(e,t,n)=>t in e?cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t,n)=>ln(e,typeof t!="symbol"?t+"":t,n);class Ie extends Error{constructor(t,n,r,a){super(t),I(this,"sourceStart"),I(this,"sourceEnd"),I(this,"parserState"),this.name="ParseError",this.sourceStart=n,this.sourceEnd=r,this.parserState=a}}class de extends Ie{constructor(t,n,r,a,o){super(t,n,r,a),I(this,"token"),this.token=o}}const ce={UnexpectedNewLineInString:"Unexpected newline while consuming a string token.",UnexpectedEOFInString:"Unexpected EOF while consuming a string token.",UnexpectedEOFInComment:"Unexpected EOF while consuming a comment.",UnexpectedEOFInURL:"Unexpected EOF while consuming a url token.",UnexpectedEOFInEscapedCodePoint:"Unexpected EOF while consuming an escaped code point.",UnexpectedCharacterInURL:"Unexpected character while consuming a url token.",InvalidEscapeSequenceInURL:"Invalid escape sequence while consuming a url token.",InvalidEscapeSequenceAfterBackslash:'Invalid escape sequence after "\\"'};function he(...e){let t="";for(let n=0;n<e.length;n++)t+=e[n][1];return t}const Ce=13,U=45,ye=10,Pe=43,we=65533;function dn(e){return e.source.codePointAt(e.cursor)===60&&e.source.codePointAt(e.cursor+1)===33&&e.source.codePointAt(e.cursor+2)===U&&e.source.codePointAt(e.cursor+3)===U}function z(e){return e>=48&&e<=57}function hn(e){return e>=65&&e<=90}function fn(e){return e>=97&&e<=122}function pe(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function pn(e){return fn(e)||hn(e)}function Ee(e){return pn(e)||vn(e)||e===95}function ot(e){return Ee(e)||z(e)||e===U}function vn(e){return e===183||e===8204||e===8205||e===8255||e===8256||e===8204||192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=893||895<=e&&e<=8191||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||63744<=e&&e<=64975||65008<=e&&e<=65533||e===0||!!ke(e)||e>=65536}function Ve(e){return e===ye||e===Ce||e===12}function ve(e){return e===32||e===ye||e===9||e===Ce||e===12}function ke(e){return e>=55296&&e<=57343}function Fe(e){return e.source.codePointAt(e.cursor)===92&&!Ve(e.source.codePointAt(e.cursor+1)??-1)}function qe(e,t){return t.source.codePointAt(t.cursor)===U?t.source.codePointAt(t.cursor+1)===U||!!Ee(t.source.codePointAt(t.cursor+1)??-1)||t.source.codePointAt(t.cursor+1)===92&&!Ve(t.source.codePointAt(t.cursor+2)??-1):!!Ee(t.source.codePointAt(t.cursor)??-1)||Fe(t)}function At(e){return e.source.codePointAt(e.cursor)===Pe||e.source.codePointAt(e.cursor)===U?!!z(e.source.codePointAt(e.cursor+1)??-1)||e.source.codePointAt(e.cursor+1)===46&&z(e.source.codePointAt(e.cursor+2)??-1):e.source.codePointAt(e.cursor)===46?z(e.source.codePointAt(e.cursor+1)??-1):z(e.source.codePointAt(e.cursor)??-1)}function mn(e){return e.source.codePointAt(e.cursor)===47&&e.source.codePointAt(e.cursor+1)===42}function gn(e){return e.source.codePointAt(e.cursor)===U&&e.source.codePointAt(e.cursor+1)===U&&e.source.codePointAt(e.cursor+2)===62}var i,h,Ke;function Nn(e){switch(e){case i.OpenParen:return i.CloseParen;case i.CloseParen:return i.OpenParen;case i.OpenCurly:return i.CloseCurly;case i.CloseCurly:return i.OpenCurly;case i.OpenSquare:return i.CloseSquare;case i.CloseSquare:return i.OpenSquare;default:return null}}function bn(e){switch(e[0]){case i.OpenParen:return[i.CloseParen,")",-1,-1,void 0];case i.CloseParen:return[i.OpenParen,"(",-1,-1,void 0];case i.OpenCurly:return[i.CloseCurly,"}",-1,-1,void 0];case i.CloseCurly:return[i.OpenCurly,"{",-1,-1,void 0];case i.OpenSquare:return[i.CloseSquare,"]",-1,-1,void 0];case i.CloseSquare:return[i.OpenSquare,"[",-1,-1,void 0];default:return null}}function Cn(e,t){for(t.advanceCodePoint(2);;){const n=t.readCodePoint();if(n===void 0){const r=[i.Comment,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return e.onParseError(new de(ce.UnexpectedEOFInComment,t.representationStart,t.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],r)),r}if(n===42&&t.source.codePointAt(t.cursor)!==void 0&&t.source.codePointAt(t.cursor)===47){t.advanceCodePoint();break}}return[i.Comment,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0]}function Xe(e,t){const n=t.readCodePoint();if(n===void 0)return e.onParseError(new Ie(ce.UnexpectedEOFInEscapedCodePoint,t.representationStart,t.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),we;if(pe(n)){const r=[n];let a;for(;(a=t.source.codePointAt(t.cursor))!==void 0&&pe(a)&&r.length<6;)r.push(a),t.advanceCodePoint();ve(t.source.codePointAt(t.cursor)??-1)&&(t.source.codePointAt(t.cursor)===Ce&&t.source.codePointAt(t.cursor+1)===ye&&t.advanceCodePoint(),t.advanceCodePoint());const o=parseInt(String.fromCodePoint(...r),16);return o===0||ke(o)||o>1114111?we:o}return n===0||ke(n)?we:n}function Ye(e,t){const n=[];for(;;){const r=t.source.codePointAt(t.cursor)??-1;if(r===0||ke(r))n.push(we),t.advanceCodePoint(+(r>65535)+1);else if(ot(r))n.push(r),t.advanceCodePoint(+(r>65535)+1);else{if(!Fe(t))return n;t.advanceCodePoint(),n.push(Xe(e,t))}}}function yn(e,t){t.advanceCodePoint();const n=t.source.codePointAt(t.cursor);if(n!==void 0&&(ot(n)||Fe(t))){let r=Ke.Unrestricted;qe(0,t)&&(r=Ke.ID);const a=Ye(e,t);return[i.Hash,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:String.fromCodePoint(...a),type:r}]}return[i.Delim,"#",t.representationStart,t.representationEnd,{value:"#"}]}function Pn(e,t){let n=h.Integer;for(t.source.codePointAt(t.cursor)!==Pe&&t.source.codePointAt(t.cursor)!==U||t.advanceCodePoint();z(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();if(t.source.codePointAt(t.cursor)===46&&z(t.source.codePointAt(t.cursor+1)??-1))for(t.advanceCodePoint(2),n=h.Number;z(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();if(t.source.codePointAt(t.cursor)===101||t.source.codePointAt(t.cursor)===69){if(z(t.source.codePointAt(t.cursor+1)??-1))t.advanceCodePoint(2);else{if(t.source.codePointAt(t.cursor+1)!==U&&t.source.codePointAt(t.cursor+1)!==Pe||!z(t.source.codePointAt(t.cursor+2)??-1))return n;t.advanceCodePoint(3)}for(n=h.Number;z(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint()}return n}function ut(e,t){let n;{const o=t.source.codePointAt(t.cursor);o===U?n="-":o===Pe&&(n="+")}const r=Pn(0,t),a=parseFloat(t.source.slice(t.representationStart,t.representationEnd+1));if(qe(0,t)){const o=Ye(e,t);return[i.Dimension,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:a,signCharacter:n,type:r,unit:String.fromCodePoint(...o)}]}return t.source.codePointAt(t.cursor)===37?(t.advanceCodePoint(),[i.Percentage,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:a,signCharacter:n}]):[i.Number,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:a,signCharacter:n,type:r}]}function wn(e){for(;ve(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();return[i.Whitespace,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}(function(e){e.Comment="comment",e.AtKeyword="at-keyword-token",e.BadString="bad-string-token",e.BadURL="bad-url-token",e.CDC="CDC-token",e.CDO="CDO-token",e.Colon="colon-token",e.Comma="comma-token",e.Delim="delim-token",e.Dimension="dimension-token",e.EOF="EOF-token",e.Function="function-token",e.Hash="hash-token",e.Ident="ident-token",e.Number="number-token",e.Percentage="percentage-token",e.Semicolon="semicolon-token",e.String="string-token",e.URL="url-token",e.Whitespace="whitespace-token",e.OpenParen="(-token",e.CloseParen=")-token",e.OpenSquare="[-token",e.CloseSquare="]-token",e.OpenCurly="{-token",e.CloseCurly="}-token",e.UnicodeRange="unicode-range-token"})(i||(i={})),function(e){e.Integer="integer",e.Number="number"}(h||(h={})),function(e){e.Unrestricted="unrestricted",e.ID="id"}(Ke||(Ke={}));class En{constructor(t){I(this,"cursor",0),I(this,"source",""),I(this,"representationStart",0),I(this,"representationEnd",-1),this.source=t}advanceCodePoint(t=1){this.cursor=this.cursor+t,this.representationEnd=this.cursor-1}readCodePoint(){const t=this.source.codePointAt(this.cursor);if(t!==void 0)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,t}unreadCodePoint(t=1){this.cursor=this.cursor-t,this.representationEnd=this.cursor-1}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1}}function kn(e,t){let n="";const r=t.readCodePoint();for(;;){const a=t.readCodePoint();if(a===void 0){const o=[i.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:n}];return e.onParseError(new de(ce.UnexpectedEOFInString,t.representationStart,t.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],o)),o}if(Ve(a)){t.unreadCodePoint();const o=[i.BadString,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return e.onParseError(new de(ce.UnexpectedNewLineInString,t.representationStart,t.source.codePointAt(t.cursor)===Ce&&t.source.codePointAt(t.cursor+1)===ye?t.representationEnd+2:t.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],o)),o}if(a===r)return[i.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:n}];if(a!==92)a===0||ke(a)?n+=String.fromCodePoint(we):n+=String.fromCodePoint(a);else{if(t.source.codePointAt(t.cursor)===void 0)continue;if(Ve(t.source.codePointAt(t.cursor)??-1)){t.source.codePointAt(t.cursor)===Ce&&t.source.codePointAt(t.cursor+1)===ye&&t.advanceCodePoint(),t.advanceCodePoint();continue}n+=String.fromCodePoint(Xe(e,t))}}}function Fn(e){return!(e.length!==3||e[0]!==117&&e[0]!==85||e[1]!==114&&e[1]!==82||e[2]!==108&&e[2]!==76)}function st(e,t){for(;;){const n=t.source.codePointAt(t.cursor);if(n===void 0)return;if(n===41)return void t.advanceCodePoint();Fe(t)?(t.advanceCodePoint(),Xe(e,t)):t.advanceCodePoint()}}function Dn(e,t){for(;ve(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();let n="";for(;;){if(t.source.codePointAt(t.cursor)===void 0){const o=[i.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:n}];return e.onParseError(new de(ce.UnexpectedEOFInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],o)),o}if(t.source.codePointAt(t.cursor)===41)return t.advanceCodePoint(),[i.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:n}];if(ve(t.source.codePointAt(t.cursor)??-1)){for(t.advanceCodePoint();ve(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();if(t.source.codePointAt(t.cursor)===void 0){const o=[i.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:n}];return e.onParseError(new de(ce.UnexpectedEOFInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],o)),o}return t.source.codePointAt(t.cursor)===41?(t.advanceCodePoint(),[i.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:n}]):(st(e,t),[i.BadURL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0])}const a=t.source.codePointAt(t.cursor);if(a===34||a===39||a===40||(r=a??-1)===11||r===127||0<=r&&r<=8||14<=r&&r<=31){st(e,t);const o=[i.BadURL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return e.onParseError(new de(ce.UnexpectedCharacterInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token",`Unexpected U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point`],o)),o}if(a===92){if(Fe(t)){t.advanceCodePoint(),n+=String.fromCodePoint(Xe(e,t));continue}st(e,t);const o=[i.BadURL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return e.onParseError(new de(ce.InvalidEscapeSequenceInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],o)),o}t.source.codePointAt(t.cursor)===0||ke(t.source.codePointAt(t.cursor)??-1)?(n+=String.fromCodePoint(we),t.advanceCodePoint()):(n+=t.source[t.cursor],t.advanceCodePoint())}var r}function it(e,t){const n=Ye(e,t);if(t.source.codePointAt(t.cursor)!==40)return[i.Ident,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:String.fromCodePoint(...n)}];if(Fn(n)){t.advanceCodePoint();let r=0;for(;;){const a=ve(t.source.codePointAt(t.cursor)??-1),o=ve(t.source.codePointAt(t.cursor+1)??-1);if(a&&o){r+=1,t.advanceCodePoint(1);continue}const u=a?t.source.codePointAt(t.cursor+1):t.source.codePointAt(t.cursor);if(u===34||u===39)return r>0&&t.unreadCodePoint(r),[i.Function,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:String.fromCodePoint(...n)}];break}return Dn(e,t)}return t.advanceCodePoint(),[i.Function,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:String.fromCodePoint(...n)}]}function Sn(e){return!(e.source.codePointAt(e.cursor)!==117&&e.source.codePointAt(e.cursor)!==85||e.source.codePointAt(e.cursor+1)!==Pe||e.source.codePointAt(e.cursor+2)!==63&&!pe(e.source.codePointAt(e.cursor+2)??-1))}function An(e,t){t.advanceCodePoint(2);const n=[],r=[];let a;for(;(a=t.source.codePointAt(t.cursor))!==void 0&&n.length<6&&pe(a);)n.push(a),t.advanceCodePoint();for(;(a=t.source.codePointAt(t.cursor))!==void 0&&n.length<6&&a===63;)r.length===0&&r.push(...n),n.push(48),r.push(70),t.advanceCodePoint();if(!r.length&&t.source.codePointAt(t.cursor)===U&&pe(t.source.codePointAt(t.cursor+1)??-1))for(t.advanceCodePoint();(a=t.source.codePointAt(t.cursor))!==void 0&&r.length<6&&pe(a);)r.push(a),t.advanceCodePoint();if(!r.length){const s=parseInt(String.fromCodePoint(...n),16);return[i.UnicodeRange,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{startOfRange:s,endOfRange:s}]}const o=parseInt(String.fromCodePoint(...n),16),u=parseInt(String.fromCodePoint(...r),16);return[i.UnicodeRange,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{startOfRange:o,endOfRange:u}]}function Bn(e,t){const n=Bt(e),r=[];for(;!n.endOfFile();)r.push(n.nextToken());return r.push(n.nextToken()),r}function Bt(e,t){const n=e.css.valueOf(),r=e.unicodeRangesAllowed??!1,a=new En(n),o={onParseError:xn};return{nextToken:function(){a.resetRepresentation();const u=a.source.codePointAt(a.cursor);if(u===void 0)return[i.EOF,"",-1,-1,void 0];if(u===47&&mn(a))return Cn(o,a);if(r&&(u===117||u===85)&&Sn(a))return An(0,a);if(Ee(u))return it(o,a);if(z(u))return ut(o,a);switch(u){case 44:return a.advanceCodePoint(),[i.Comma,",",a.representationStart,a.representationEnd,void 0];case 58:return a.advanceCodePoint(),[i.Colon,":",a.representationStart,a.representationEnd,void 0];case 59:return a.advanceCodePoint(),[i.Semicolon,";",a.representationStart,a.representationEnd,void 0];case 40:return a.advanceCodePoint(),[i.OpenParen,"(",a.representationStart,a.representationEnd,void 0];case 41:return a.advanceCodePoint(),[i.CloseParen,")",a.representationStart,a.representationEnd,void 0];case 91:return a.advanceCodePoint(),[i.OpenSquare,"[",a.representationStart,a.representationEnd,void 0];case 93:return a.advanceCodePoint(),[i.CloseSquare,"]",a.representationStart,a.representationEnd,void 0];case 123:return a.advanceCodePoint(),[i.OpenCurly,"{",a.representationStart,a.representationEnd,void 0];case 125:return a.advanceCodePoint(),[i.CloseCurly,"}",a.representationStart,a.representationEnd,void 0];case 39:case 34:return kn(o,a);case 35:return yn(o,a);case Pe:case 46:return At(a)?ut(o,a):(a.advanceCodePoint(),[i.Delim,a.source[a.representationStart],a.representationStart,a.representationEnd,{value:a.source[a.representationStart]}]);case ye:case Ce:case 12:case 9:case 32:return wn(a);case U:return At(a)?ut(o,a):gn(a)?(a.advanceCodePoint(3),[i.CDC,"-->",a.representationStart,a.representationEnd,void 0]):qe(0,a)?it(o,a):(a.advanceCodePoint(),[i.Delim,"-",a.representationStart,a.representationEnd,{value:"-"}]);case 60:return dn(a)?(a.advanceCodePoint(4),[i.CDO,"<!--",a.representationStart,a.representationEnd,void 0]):(a.advanceCodePoint(),[i.Delim,"<",a.representationStart,a.representationEnd,{value:"<"}]);case 64:if(a.advanceCodePoint(),qe(0,a)){const s=Ye(o,a);return[i.AtKeyword,a.source.slice(a.representationStart,a.representationEnd+1),a.representationStart,a.representationEnd,{value:String.fromCodePoint(...s)}]}return[i.Delim,"@",a.representationStart,a.representationEnd,{value:"@"}];case 92:{if(Fe(a))return it(o,a);a.advanceCodePoint();const s=[i.Delim,"\\",a.representationStart,a.representationEnd,{value:"\\"}];return o.onParseError(new de(ce.InvalidEscapeSequenceAfterBackslash,a.representationStart,a.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],s)),s}}return a.advanceCodePoint(),[i.Delim,a.source[a.representationStart],a.representationStart,a.representationEnd,{value:a.source[a.representationStart]}]},endOfFile:function(){return a.source.codePointAt(a.cursor)===void 0}}}function xn(){}function xt(e,t){const n=[];for(const s of t)n.push(s.codePointAt(0));const r=Mn(n);r[0]===101&&We(r,0,r[0]);const a=String.fromCodePoint(...r),o=e[4].signCharacter==="+"?e[4].signCharacter:"",u=e[4].value.toString();e[1]=`${o}${u}${a}`,e[4].unit=t}function Mn(e){let t=0;e[0]===U&&e[1]===U?t=2:e[0]===U&&e[1]?(t=2,Ee(e[1])||(t+=We(e,1,e[1]))):Ee(e[0])?t=1:(t=1,t+=We(e,0,e[0]));for(let n=t;n<e.length;n++)ot(e[n])||(n+=We(e,n,e[n]));return e}function We(e,t,n){const r=n.toString(16),a=[];for(const u of r)a.push(u.codePointAt(0));const o=e[t+1];return t===e.length-1||o&&pe(o)?(e.splice(t,1,92,...a,32),1+a.length):(e.splice(t,1,92,...a),a.length)}const In=Object.values(i);function ct(e){return!!Array.isArray(e)&&!(e.length<4)&&!!In.includes(e[0])&&typeof e[1]=="string"&&typeof e[2]=="number"&&typeof e[3]=="number"}function M(e){if(!e)return!1;switch(e[0]){case i.Dimension:case i.Number:case i.Percentage:return!0;default:return!1}}function Mt(e){if(!e)return!1;switch(e[0]){case i.Whitespace:case i.Comment:return!0;default:return!1}}function re(e){return!!e&&e[0]===i.Comma}function It(e){return!!e&&e[0]===i.Comment}function ze(e){return!!e&&e[0]===i.Delim}function A(e){return!!e&&e[0]===i.Dimension}function fe(e){return!!e&&e[0]===i.EOF}function Hn(e){return!!e&&e[0]===i.Function}function On(e){return!!e&&e[0]===i.Hash}function H(e){return!!e&&e[0]===i.Ident}function N(e){return!!e&&e[0]===i.Number}function D(e){return!!e&&e[0]===i.Percentage}function lt(e){return!!e&&e[0]===i.Whitespace}function Ht(e){return!!e&&e[0]===i.OpenParen}function Ln(e){return!!e&&e[0]===i.CloseParen}function Rn(e){return!!e&&e[0]===i.OpenSquare}function Un(e){return!!e&&e[0]===i.OpenCurly}function _(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]}const _n=[.955473421488075,-.02309845494876471,.06325924320057072,-.0283697093338637,1.0099953980813041,.021041441191917323,.012314014864481998,-.020507649298898964,1.330365926242124];function ae(e){return _(_n,e)}const Gn=[1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371];function oe(e){return _(Gn,e)}function Ot(e){let t=e[0]%360;const n=e[1]/100,r=e[2]/100;return t<0&&(t+=360),[dt(0,t,n,r),dt(8,t,n,r),dt(4,t,n,r)]}function dt(e,t,n,r){const a=(e+t/30)%12;return r-n*Math.min(r,1-r)*Math.max(-1,Math.min(a-3,9-a,1))}function Tn(e){const t=e[0],n=e[1]/100,r=e[2]/100;if(n+r>=1){const u=n/(n+r);return[u,u,u]}const a=Ot([t,100,50]),o=1-n-r;return[a[0]*o+n,a[1]*o+n,a[2]*o+n]}function Vn(e){const t=e[2]*Math.PI/180;return[e[0],e[1]*Math.cos(t),e[1]*Math.sin(t)]}function qn(e){const t=180*Math.atan2(e[2],e[1])/Math.PI;return[e[0],Math.sqrt(Math.pow(e[1],2)+Math.pow(e[2],2)),t>=0?t:t+360]}const De=[.3457/.3585,1,.2958/.3585];function Lt(e){const t=903.2962962962963,n=216/24389,r=(e[0]+16)/116,a=e[1]/500+r,o=r-e[2]/200;return[(Math.pow(a,3)>n?Math.pow(a,3):(116*a-16)/t)*De[0],(e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/t)*De[1],(Math.pow(o,3)>n?Math.pow(o,3):(116*o-16)/t)*De[2]]}function Rt(e){const t=e[2]*Math.PI/180;return[e[0],e[1]*Math.cos(t),e[1]*Math.sin(t)]}function Ut(e){const t=180*Math.atan2(e[2],e[1])/Math.PI;return[e[0],Math.sqrt(e[1]**2+e[2]**2),t>=0?t:t+360]}const Kn=[1.2268798758459243,-.5578149944602171,.2813910456659647,-.0405757452148008,1.112286803280317,-.0717110580655164,-.0763729366746601,-.4214933324022432,1.5869240198367816],Xn=[1,.3963377773761749,.2158037573099136,1,-.1055613458156586,-.0638541728258133,1,-.0894841775298119,-1.2914855480194092];function ht(e){const t=_(Xn,e);return _(Kn,[t[0]**3,t[1]**3,t[2]**3])}function _t(e){const t=ft(e[0]/De[0]),n=ft(e[1]/De[1]);return[116*n-16,500*(t-n),200*(n-ft(e[2]/De[2]))]}const Yn=216/24389,Wn=24389/27;function ft(e){return e>Yn?Math.cbrt(e):(Wn*e+16)/116}const zn=[.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],Zn=[.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774];function pt(e){const t=_(zn,e);return _(Zn,[Math.cbrt(t[0]),Math.cbrt(t[1]),Math.cbrt(t[2])])}const jn=[30757411/17917100,-6372589/17917100,-4539589/17917100,-.666684351832489,1.616481236634939,467509/29648200,792561/44930125,-1921689/44930125,.942103121235474],Jn=[446124/178915,-333277/357830,-72051/178915,-14852/17905,63121/35810,423/17905,11844/330415,-50337/660830,316169/330415];function $n(e){return _(Jn,e)}const Qn=[1.3457868816471583,-.25557208737979464,-.05110186497554526,-.5446307051249019,1.5082477428451468,.02052744743642139,0,0,1.2119675456389452],er=[1829569/896150,-506331/896150,-308931/896150,-851781/878810,1648619/878810,36519/878810,16779/1248040,-147721/1248040,1266979/1248040],tr=[12831/3959,-329/214,-1974/3959,-851781/878810,1648619/878810,36519/878810,705/12673,-2585/12673,705/667];function He(e){return _(tr,e)}const Gt=1.09929682680944,nr=.018053968510807;function vt(e){const t=e<0?-1:1,n=Math.abs(e);return n>nr?t*(Gt*Math.pow(n,.45)-(Gt-1)):4.5*e}function Oe(e){return[mt(e[0]),mt(e[1]),mt(e[2])]}function mt(e){const t=e<0?-1:1,n=Math.abs(e);return n>.0031308?t*(1.055*Math.pow(n,1/2.4)-.055):12.92*e}function rr(e){return Oe(e)}const ar=1/512;function gt(e){const t=e<0?-1:1,n=Math.abs(e);return n>=ar?t*Math.pow(n,1/1.8):16*e}function Nt(e){const t=e<0?-1:1,n=Math.abs(e);return t*Math.pow(n,256/563)}const Tt=1.09929682680944,or=.018053968510807;function bt(e){const t=e<0?-1:1,n=Math.abs(e);return n<4.5*or?e/4.5:t*Math.pow((n+Tt-1)/Tt,1/.45)}const ur=[63426534/99577255,20160776/139408157,47086771/278816314,26158966/99577255,.677998071518871,8267143/139408157,0,19567812/697040785,1.0609850577107909];function Ze(e){return[Ct(e[0]),Ct(e[1]),Ct(e[2])]}function Ct(e){const t=e<0?-1:1,n=Math.abs(e);return n<=.04045?e/12.92:t*Math.pow((n+.055)/1.055,2.4)}function sr(e){return Ze(e)}const ir=[608311/1250200,189793/714400,198249/1000160,35783/156275,247089/357200,198249/2500400,0,32229/714400,5220557/5000800];function cr(e){return _(ir,e)}const lr=16/512;function yt(e){const t=e<0?-1:1,n=Math.abs(e);return n<=lr?e/16:t*Math.pow(n,1.8)}const dr=[.7977666449006423,.13518129740053308,.0313477341283922,.2880748288194013,.711835234241873,8993693872564e-17,0,0,.8251046025104602];function Pt(e){const t=e<0?-1:1,n=Math.abs(e);return t*Math.pow(n,563/256)}const hr=[573536/994567,263643/1420810,187206/994567,591459/1989134,6239551/9945670,374412/4972835,53769/1989134,351524/4972835,4929758/4972835],fr=[506752/1228815,87881/245763,12673/70218,87098/409605,175762/245763,12673/175545,7918/409605,87881/737289,1001167/1053270];function Le(e){return _(fr,e)}function pr(e){const t=e[0],n=e[1],r=e[2],a=Math.max(t,n,r),o=Math.min(t,n,r),u=(o+a)/2,s=a-o;let l=Number.NaN,d=0;if(Math.round(1e5*s)!==0){const f=Math.round(1e5*u);switch(d=f===0||f===1e5?0:(a-u)/Math.min(u,1-u),a){case t:l=(n-r)/s+(n<r?6:0);break;case n:l=(r-t)/s+2;break;case r:l=(t-n)/s+4}l*=60}return d<0&&(l+=180,d=Math.abs(d)),l>=360&&(l-=360),[l,100*d,100*u]}function vr(e){const t=e[0],n=e[1],r=e[2],a=Math.max(t,n,r),o=Math.min(t,n,r);let u=Number.NaN;const s=a-o;if(s!==0){switch(a){case t:u=(n-r)/s+(n<r?6:0);break;case n:u=(r-t)/s+2;break;case r:u=(t-n)/s+4}u*=60}return u>=360&&(u-=360),u}function mr(e){let t=e;return t=Ze(t),t=Le(t),t=oe(t),t}function je(e){let t=e;return t=ae(t),t=He(t),t=Oe(t),t}function gr(e){let t=e;return t=Ot(t),t=Ze(t),t=Le(t),t=oe(t),t}function Nr(e){let t=e;return t=ae(t),t=He(t),t=Oe(t),t=pr(t),t}function br(e){let t=e;return t=Tn(t),t=Ze(t),t=Le(t),t=oe(t),t}function Cr(e){let t=e;t=ae(t),t=He(t);const n=Oe(t),r=Math.min(n[0],n[1],n[2]),a=1-Math.max(n[0],n[1],n[2]);return[vr(n),100*r,100*a]}function yr(e){let t=e;return t=Lt(t),t}function Pr(e){let t=e;return t=_t(t),t}function wr(e){let t=e;return t=Vn(t),t=Lt(t),t}function Er(e){let t=e;return t=_t(t),t=qn(t),t}function kr(e){let t=e;return t=ht(t),t=oe(t),t}function Fr(e){let t=e;return t=ae(t),t=pt(t),t}function Dr(e){let t=e;return t=Rt(t),t=ht(t),t=oe(t),t}function Vt(e){let t=e;return t=ae(t),t=pt(t),t=Ut(t),t}function Sr(e){let t=e;return t=Le(t),t=oe(t),t}function Ar(e){let t=e;return t=ae(t),t=He(t),t}function Br(e){let t=e;var n;return t=[Pt((n=t)[0]),Pt(n[1]),Pt(n[2])],t=_(hr,t),t=oe(t),t}function xr(e){let t=e;var n;return t=ae(t),t=_(er,t),t=[Nt((n=t)[0]),Nt(n[1]),Nt(n[2])],t}function Mr(e){let t=e;return t=sr(t),t=cr(t),t=oe(t),t}function Ir(e){let t=e;return t=ae(t),t=$n(t),t=rr(t),t}function Hr(e){let t=e;var n;return t=[bt((n=t)[0]),bt(n[1]),bt(n[2])],t=_(ur,t),t=oe(t),t}function Or(e){let t=e;var n;return t=ae(t),t=_(jn,t),t=[vt((n=t)[0]),vt(n[1]),vt(n[2])],t}function Lr(e){let t=e;var n;return t=[yt((n=t)[0]),yt(n[1]),yt(n[2])],t=_(dr,t),t}function Rr(e){let t=e;var n;return t=_(Qn,t),t=[gt((n=t)[0]),gt(n[1]),gt(n[2])],t}function Ur(e){let t=e;return t=oe(t),t}function _r(e){let t=e;return t=ae(t),t}function Gr(e){return e[0]>=-1e-4&&e[0]<=1.0001&&e[1]>=-1e-4&&e[1]<=1.0001&&e[2]>=-1e-4&&e[2]<=1.0001}function qt(e){return[e[0]<0?0:e[0]>1?1:e[0],e[1]<0?0:e[1]>1?1:e[1],e[2]<0?0:e[2]>1?1:e[2]]}function Tr(e,t,n){const r=e[0],a=e[2];let o=t(e);const u=t([r,0,a]);for(let s=0;s<4;s++){if(s>0){const d=n(o);d[0]=r,d[2]=a,o=t(d)}const l=Vr(u,o);if(!l)break;o=l}return qt(o)}function Vr(e,t){let n=1/0,r=-1/0;const a=[0,0,0];for(let o=0;o<3;o++){const u=e[o],s=t[o]-u;a[o]=s;const l=0,d=1;if(s){const f=1/s,v=(l-u)*f,b=(d-u)*f;r=Math.max(Math.min(v,b),r),n=Math.min(Math.max(v,b),n)}else if(u<l||u>d)return!1}return!(r>n||n<0)&&(r<0&&(r=n),!!isFinite(r)&&[e[0]+a[0]*r,e[1]+a[1]*r,e[2]+a[2]*r])}const qr={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]};function Kt(e){const[t,n,r]=e.map(a=>a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4));return .2126*t+.7152*n+.0722*r}function Xt(e,t){const n=Kt(e),r=Kt(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}var Z;function Yt(e){let t=e.slice();return(n,r,a)=>{let o=-1;for(let u=t.indexOf(r);u<t.length&&(o=n.indexOf(t[u]),o===-1||o<a);u++);return o===-1||o===a&&r===n[a]&&(o++,o>=n.length)?-1:(t=n.slice(),o)}}function wt(e,t){const n=t[0];if(Ht(n)||Un(n)||Rn(n)){const r=Xr(e,t);return{advance:r.advance,node:r.node}}if(Hn(n)){const r=Kr(e,t);return{advance:r.advance,node:r.node}}if(lt(n)){const r=zt(e,t);return{advance:r.advance,node:r.node}}if(It(n)){const r=Yr(e,t);return{advance:r.advance,node:r.node}}return{advance:1,node:new g(n)}}(function(e){e.Function="function",e.SimpleBlock="simple-block",e.Whitespace="whitespace",e.Comment="comment",e.Token="token"})(Z||(Z={}));class Wt{constructor(){I(this,"value",[])}indexOf(t){return this.value.indexOf(t)}at(t){if(typeof t=="number")return t<0&&(t=this.value.length+t),this.value[t]}forEach(t,n){if(this.value.length===0)return;const r=Yt(this.value);let a=0;for(;a<this.value.length;){const o=this.value[a];let u;if(n&&(u={...n}),t({node:o,parent:this,state:u},a)===!1)return!1;if(a=r(this.value,o,a),a===-1)break}}walk(t,n){this.value.length!==0&&this.forEach((r,a)=>t(r,a)!==!1&&(!("walk"in r.node)||!this.value.includes(r.node)||r.node.walk(t,r.state)!==!1)&&void 0,n)}}class L extends Wt{constructor(t,n,r){super(),I(this,"type",Z.Function),I(this,"name"),I(this,"endToken"),this.name=t,this.endToken=n,this.value=r}getName(){return this.name[4].value}normalize(){fe(this.endToken)&&(this.endToken=[i.CloseParen,")",-1,-1,void 0])}tokens(){return fe(this.endToken)?[this.name,...this.value.flatMap(t=>t.tokens())]:[this.name,...this.value.flatMap(t=>t.tokens()),this.endToken]}toString(){const t=this.value.map(n=>ct(n)?he(n):n.toString()).join("");return he(this.name)+t+he(this.endToken)}toJSON(){return{type:this.type,name:this.getName(),tokens:this.tokens(),value:this.value.map(t=>t.toJSON())}}isFunctionNode(){return L.isFunctionNode(this)}static isFunctionNode(t){return!!t&&t instanceof L&&t.type===Z.Function}}function Kr(e,t){const n=[];let r=1;for(;;){const a=t[r];if(!a||fe(a))return e.onParseError(new Ie("Unexpected EOF while consuming a function.",t[0][2],t[t.length-1][3],["5.4.9. Consume a function","Unexpected EOF"])),{advance:t.length,node:new L(t[0],a,n)};if(Ln(a))return{advance:r+1,node:new L(t[0],a,n)};if(Mt(a)){const u=Zt(e,t.slice(r));r+=u.advance,n.push(...u.nodes);continue}const o=wt(e,t.slice(r));r+=o.advance,n.push(o.node)}}class xe extends Wt{constructor(t,n,r){super(),I(this,"type",Z.SimpleBlock),I(this,"startToken"),I(this,"endToken"),this.startToken=t,this.endToken=n,this.value=r}normalize(){if(fe(this.endToken)){const t=bn(this.startToken);t&&(this.endToken=t)}}tokens(){return fe(this.endToken)?[this.startToken,...this.value.flatMap(t=>t.tokens())]:[this.startToken,...this.value.flatMap(t=>t.tokens()),this.endToken]}toString(){const t=this.value.map(n=>ct(n)?he(n):n.toString()).join("");return he(this.startToken)+t+he(this.endToken)}toJSON(){return{type:this.type,startToken:this.startToken,tokens:this.tokens(),value:this.value.map(t=>t.toJSON())}}isSimpleBlockNode(){return xe.isSimpleBlockNode(this)}static isSimpleBlockNode(t){return!!t&&t instanceof xe&&t.type===Z.SimpleBlock}}function Xr(e,t){const n=Nn(t[0][0]);if(!n)throw new Error("Failed to parse, a mirror variant must exist for all block open tokens.");const r=[];let a=1;for(;;){const o=t[a];if(!o||fe(o))return e.onParseError(new Ie("Unexpected EOF while consuming a simple block.",t[0][2],t[t.length-1][3],["5.4.8. Consume a simple block","Unexpected EOF"])),{advance:t.length,node:new xe(t[0],o,r)};if(o[0]===n)return{advance:a+1,node:new xe(t[0],o,r)};if(Mt(o)){const s=Zt(e,t.slice(a));a+=s.advance,r.push(...s.nodes);continue}const u=wt(e,t.slice(a));a+=u.advance,r.push(u.node)}}class R{constructor(t){I(this,"type",Z.Whitespace),I(this,"value"),this.value=t}tokens(){return this.value}toString(){return he(...this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isWhitespaceNode(){return R.isWhitespaceNode(this)}static isWhitespaceNode(t){return!!t&&t instanceof R&&t.type===Z.Whitespace}}function zt(e,t){let n=0;for(;;){const r=t[n];if(!lt(r))return{advance:n,node:new R(t.slice(0,n))};n++}}class Me{constructor(t){I(this,"type",Z.Comment),I(this,"value"),this.value=t}tokens(){return[this.value]}toString(){return he(this.value)}toJSON(){return{type:this.type,tokens:this.tokens()}}isCommentNode(){return Me.isCommentNode(this)}static isCommentNode(t){return!!t&&t instanceof Me&&t.type===Z.Comment}}function Yr(e,t){return{advance:1,node:new Me(t[0])}}function Zt(e,t){const n=[];let r=0;for(;;)if(lt(t[r])){const a=zt(0,t.slice(r));r+=a.advance,n.push(a.node)}else{if(!It(t[r]))return{advance:r,nodes:n};n.push(new Me(t[r])),r++}}class g{constructor(t){I(this,"type",Z.Token),I(this,"value"),this.value=t}tokens(){return[this.value]}toString(){return this.value[1]}toJSON(){return{type:this.type,tokens:this.tokens()}}isTokenNode(){return g.isTokenNode(this)}static isTokenNode(t){return!!t&&t instanceof g&&t.type===Z.Token}}function Wr(e,t){const n={onParseError:()=>{}},r=[...e];fe(r[r.length-1])&&r.push([i.EOF,"",r[r.length-1][2],r[r.length-1][3],void 0]);const a=wt(n,r);if(fe(r[Math.min(a.advance,r.length-1)]))return a.node;n.onParseError(new Ie("Expected EOF after parsing a component value.",e[0][2],e[e.length-1][3],["5.3.9. Parse a component value","Expected EOF"]))}function zr(e,t,n){if(e.length===0)return;const r=Yt(e);let a=0;for(;a<e.length;){const o=e[a];if(t({node:o,parent:{value:e},state:void 0},a)===!1)return!1;if(a=r(e,o,a),a===-1)break}}function Zr(e,t,n){e.length!==0&&zr(e,(r,a)=>t(r,a)!==!1&&(!("walk"in r.node)||!e.includes(r.node)||r.node.walk(t,r.state)!==!1)&&void 0)}function jr(e,t){for(let n=0;n<e.length;n++)Zr(e[n],(r,a)=>{if(typeof a!="number")return;const o=t(r.node);o&&(Array.isArray(o)?r.parent.value.splice(a,1,...o):r.parent.value.splice(a,1,o))});return e}function Jr(e){return xe.isSimpleBlockNode(e)}function j(e){return L.isFunctionNode(e)}function J(e){return R.isWhitespaceNode(e)}function $(e){return Me.isCommentNode(e)}function me(e){return J(e)||$(e)}function m(e){return g.isTokenNode(e)}const $r=/[A-Z]/g;function V(e){return e.replace($r,t=>String.fromCharCode(t.charCodeAt(0)+32))}const Qr={cm:"px",in:"px",mm:"px",pc:"px",pt:"px",px:"px",q:"px",deg:"deg",grad:"deg",rad:"deg",turn:"deg",ms:"s",s:"s",hz:"hz",khz:"hz"},ea=new Map([["cm",e=>e],["mm",e=>10*e],["q",e=>40*e],["in",e=>e/2.54],["pc",e=>e/2.54*6],["pt",e=>e/2.54*72],["px",e=>e/2.54*96]]),Je=new Map([["deg",e=>e],["grad",e=>e/.9],["rad",e=>e/180*Math.PI],["turn",e=>e/360]]),Re=new Map([["deg",e=>.9*e],["grad",e=>e],["rad",e=>.9*e/180*Math.PI],["turn",e=>.9*e/360]]),ta=new Map([["hz",e=>e],["khz",e=>e/1e3]]),na=new Map([["cm",e=>2.54*e],["mm",e=>25.4*e],["q",e=>25.4*e*4],["in",e=>e],["pc",e=>6*e],["pt",e=>72*e],["px",e=>96*e]]),ra=new Map([["hz",e=>1e3*e],["khz",e=>e]]),aa=new Map([["cm",e=>e/10],["mm",e=>e],["q",e=>4*e],["in",e=>e/25.4],["pc",e=>e/25.4*6],["pt",e=>e/25.4*72],["px",e=>e/25.4*96]]),oa=new Map([["ms",e=>e],["s",e=>e/1e3]]),ua=new Map([["cm",e=>e/6*2.54],["mm",e=>e/6*25.4],["q",e=>e/6*25.4*4],["in",e=>e/6],["pc",e=>e],["pt",e=>e/6*72],["px",e=>e/6*96]]),sa=new Map([["cm",e=>e/72*2.54],["mm",e=>e/72*25.4],["q",e=>e/72*25.4*4],["in",e=>e/72],["pc",e=>e/72*6],["pt",e=>e],["px",e=>e/72*96]]),ia=new Map([["cm",e=>e/96*2.54],["mm",e=>e/96*25.4],["q",e=>e/96*25.4*4],["in",e=>e/96],["pc",e=>e/96*6],["pt",e=>e/96*72],["px",e=>e]]),ca=new Map([["cm",e=>e/4/10],["mm",e=>e/4],["q",e=>e],["in",e=>e/4/25.4],["pc",e=>e/4/25.4*6],["pt",e=>e/4/25.4*72],["px",e=>e/4/25.4*96]]),jt=new Map([["deg",e=>180*e/Math.PI],["grad",e=>180*e/Math.PI/.9],["rad",e=>e],["turn",e=>180*e/Math.PI/360]]),la=new Map([["ms",e=>1e3*e],["s",e=>e]]),Ue=new Map([["deg",e=>360*e],["grad",e=>360*e/.9],["rad",e=>360*e/180*Math.PI],["turn",e=>e]]),Jt=new Map([["cm",ea],["mm",aa],["q",ca],["in",na],["pc",ua],["pt",sa],["px",ia],["ms",oa],["s",la],["deg",Je],["grad",Re],["rad",jt],["turn",Ue],["hz",ta],["khz",ra]]);function X(e,t){if(!A(e)||!A(t))return t;const n=V(e[4].unit),r=V(t[4].unit);if(n===r)return t;const a=Jt.get(r);if(!a)return t;const o=a.get(n);if(!o)return t;const u=o(t[4].value),s=[i.Dimension,"",t[2],t[3],{...t[4],signCharacter:u<0?"-":void 0,type:Number.isInteger(u)?h.Integer:h.Number,value:u}];return xt(s,e[4].unit),s}function da(e){if(!A(e))return e;const t=V(e[4].unit),n=Qr[t];if(t===n)return e;const r=Jt.get(t);if(!r)return e;const a=r.get(n);if(!a)return e;const o=a(e[4].value),u=[i.Dimension,"",e[2],e[3],{...e[4],signCharacter:o<0?"-":void 0,type:Number.isInteger(o)?h.Integer:h.Number,value:o}];return xt(u,n),u}function ha(e){if(e.length!==2)return-1;const t=e[0].value;let n=e[1].value;if(N(t)&&N(n)){const r=t[4].value+n[4].value;return new g([i.Number,r.toString(),t[2],n[3],{value:r,type:t[4].type===h.Integer&&n[4].type===h.Integer?h.Integer:h.Number}])}if(D(t)&&D(n)){const r=t[4].value+n[4].value;return new g([i.Percentage,r.toString()+"%",t[2],n[3],{value:r}])}if(A(t)&&A(n)&&(n=X(t,n),V(t[4].unit)===V(n[4].unit))){const r=t[4].value+n[4].value;return new g([i.Dimension,r.toString()+t[4].unit,t[2],n[3],{value:r,type:t[4].type===h.Integer&&n[4].type===h.Integer?h.Integer:h.Number,unit:t[4].unit}])}return-1}function fa(e){if(e.length!==2)return-1;const t=e[0].value,n=e[1].value;if(N(t)&&N(n)){const r=t[4].value/n[4].value;return new g([i.Number,r.toString(),t[2],n[3],{value:r,type:Number.isInteger(r)?h.Integer:h.Number}])}if(D(t)&&N(n)){const r=t[4].value/n[4].value;return new g([i.Percentage,r.toString()+"%",t[2],n[3],{value:r}])}if(A(t)&&N(n)){const r=t[4].value/n[4].value;return new g([i.Dimension,r.toString()+t[4].unit,t[2],n[3],{value:r,type:Number.isInteger(r)?h.Integer:h.Number,unit:t[4].unit}])}return-1}function ge(e){return!!e&&typeof e=="object"&&"inputs"in e&&Array.isArray(e.inputs)&&"operation"in e}function q(e){if(e===-1)return-1;const t=[];for(let n=0;n<e.inputs.length;n++){const r=e.inputs[n];if(m(r)){t.push(r);continue}const a=q(r);if(a===-1)return-1;t.push(a)}return e.operation(t)}function pa(e){if(e.length!==2)return-1;const t=e[0].value,n=e[1].value;if(N(t)&&N(n)){const r=t[4].value*n[4].value;return new g([i.Number,r.toString(),t[2],n[3],{value:r,type:t[4].type===h.Integer&&n[4].type===h.Integer?h.Integer:h.Number}])}if(D(t)&&N(n)){const r=t[4].value*n[4].value;return new g([i.Percentage,r.toString()+"%",t[2],n[3],{value:r}])}if(N(t)&&D(n)){const r=t[4].value*n[4].value;return new g([i.Percentage,r.toString()+"%",t[2],n[3],{value:r}])}if(A(t)&&N(n)){const r=t[4].value*n[4].value;return new g([i.Dimension,r.toString()+t[4].unit,t[2],n[3],{value:r,type:t[4].type===h.Integer&&n[4].type===h.Integer?h.Integer:h.Number,unit:t[4].unit}])}if(N(t)&&A(n)){const r=t[4].value*n[4].value;return new g([i.Dimension,r.toString()+n[4].unit,t[2],n[3],{value:r,type:t[4].type===h.Integer&&n[4].type===h.Integer?h.Integer:h.Number,unit:n[4].unit}])}return-1}function Se(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(!m(r))continue;const a=r.value;if(!H(a))continue;const o=V(a[4].value);switch(o){case"e":e.splice(n,1,new g([i.Number,Math.E.toString(),a[2],a[3],{value:Math.E,type:h.Number}]));break;case"pi":e.splice(n,1,new g([i.Number,Math.PI.toString(),a[2],a[3],{value:Math.PI,type:h.Number}]));break;case"infinity":e.splice(n,1,new g([i.Number,"infinity",a[2],a[3],{value:1/0,type:h.Number}]));break;case"-infinity":e.splice(n,1,new g([i.Number,"-infinity",a[2],a[3],{value:-1/0,type:h.Number}]));break;case"nan":e.splice(n,1,new g([i.Number,"NaN",a[2],a[3],{value:Number.NaN,type:h.Number}]));break;default:if(t.has(o)){const u=t.get(o);e.splice(n,1,new g(u))}}}return e}function $e(e){if(e.length!==1)return-1;const t=e[0].value;return M(t)?e[0]:-1}function Q(e,t,n){return A(t)?_e(e,t[4].unit,n):D(t)?va(e,n):N(t)?ue(e,n):-1}function _e(e,t,n){const r=e.tokens();return{inputs:[new g([i.Dimension,n.toString()+t,r[0][2],r[r.length-1][3],{value:n,type:Number.isInteger(n)?h.Integer:h.Number,unit:t}])],operation:$e}}function va(e,t){const n=e.tokens();return{inputs:[new g([i.Percentage,t.toString()+"%",n[0][2],n[n.length-1][3],{value:t}])],operation:$e}}function ue(e,t){const n=e.tokens();return{inputs:[new g([i.Number,t.toString(),n[0][2],n[n.length-1][3],{value:t,type:Number.isInteger(t)?h.Integer:h.Number}])],operation:$e}}function ma(e,t){const n=t.value;return N(n)?_e(e,"rad",Math.acos(n[4].value)):-1}function ga(e,t){const n=t.value;return N(n)?_e(e,"rad",Math.asin(n[4].value)):-1}function Na(e,t){const n=t.value;return N(n)?_e(e,"rad",Math.atan(n[4].value)):-1}function Qe(e){return A(e)||N(e)}function Et(e){if(e.length===0)return!0;const t=e[0];if(!M(t))return!1;if(e.length===1)return!0;if(A(t)){const n=V(t[4].unit);for(let r=1;r<e.length;r++){const a=e[r];if(t[0]!==a[0]||n!==V(a[4].unit))return!1}return!0}for(let n=1;n<e.length;n++){const r=e[n];if(t[0]!==r[0])return!1}return!0}function le(e,t){return!!M(e)&&(A(e)?e[0]===t[0]&&V(e[4].unit)===V(t[4].unit):e[0]===t[0])}function ba(e,t,n){const r=t.value;if(!Qe(r))return-1;const a=X(r,n.value);return le(r,a)?_e(e,"rad",Math.atan2(r[4].value,a[4].value)):-1}function Ca(e,t,n){const r=t.value;return!M(r)||!n.rawPercentages&&D(r)?-1:Q(e,r,Math.abs(r[4].value))}function ya(e,t,n,r,a){if(!m(t)||!m(n)||!m(r))return-1;const o=t.value;if(!M(o)||!a.rawPercentages&&D(o))return-1;const u=X(o,n.value);if(!le(o,u))return-1;const s=X(o,r.value);return le(o,s)?Q(e,o,Math.max(o[4].value,Math.min(u[4].value,s[4].value))):-1}function Pa(e,t){const n=t.value;if(!Qe(n))return-1;let r=n[4].value;if(A(n))switch(n[4].unit.toLowerCase()){case"rad":break;case"deg":r=Je.get("rad")(n[4].value);break;case"grad":r=Re.get("rad")(n[4].value);break;case"turn":r=Ue.get("rad")(n[4].value);break;default:return-1}return r=Math.cos(r),ue(e,r)}function wa(e,t){const n=t.value;return N(n)?ue(e,Math.exp(n[4].value)):-1}function Ea(e,t,n){if(!t.every(m))return-1;const r=t[0].value;if(!M(r)||!n.rawPercentages&&D(r))return-1;const a=t.map(s=>X(r,s.value));if(!Et(a))return-1;const o=a.map(s=>s[4].value),u=Math.hypot(...o);return Q(e,r,u)}function $t(e,t,n){if(!t.every(m))return-1;const r=t[0].value;if(!M(r)||!n.rawPercentages&&D(r))return-1;const a=t.map(s=>X(r,s.value));if(!Et(a))return-1;const o=a.map(s=>s[4].value),u=Math.max(...o);return Q(e,r,u)}function Qt(e,t,n){if(!t.every(m))return-1;const r=t[0].value;if(!M(r)||!n.rawPercentages&&D(r))return-1;const a=t.map(s=>X(r,s.value));if(!Et(a))return-1;const o=a.map(s=>s[4].value),u=Math.min(...o);return Q(e,r,u)}function ka(e,t,n){const r=t.value;if(!M(r))return-1;const a=X(r,n.value);if(!le(r,a))return-1;let o;return o=a[4].value===0?Number.NaN:Number.isFinite(r[4].value)&&(Number.isFinite(a[4].value)||(a[4].value!==Number.POSITIVE_INFINITY||r[4].value!==Number.NEGATIVE_INFINITY&&!Object.is(0*r[4].value,-0))&&(a[4].value!==Number.NEGATIVE_INFINITY||r[4].value!==Number.POSITIVE_INFINITY&&!Object.is(0*r[4].value,0)))?Number.isFinite(a[4].value)?(r[4].value%a[4].value+a[4].value)%a[4].value:r[4].value:Number.NaN,Q(e,r,o)}function Fa(e,t,n){const r=t.value,a=n.value;return!N(r)||!le(r,a)?-1:ue(e,Math.pow(r[4].value,a[4].value))}function Da(e,t,n){const r=t.value;if(!M(r))return-1;const a=X(r,n.value);if(!le(r,a))return-1;let o;return o=a[4].value===0?Number.NaN:Number.isFinite(r[4].value)?Number.isFinite(a[4].value)?r[4].value%a[4].value:r[4].value:Number.NaN,Q(e,r,o)}function Sa(e,t,n,r,a){const o=n.value;if(!M(o)||!a.rawPercentages&&D(o))return-1;const u=X(o,r.value);if(!le(o,u))return-1;let s;if(u[4].value===0)s=Number.NaN;else if(Number.isFinite(o[4].value)||Number.isFinite(u[4].value))if(!Number.isFinite(o[4].value)&&Number.isFinite(u[4].value))s=o[4].value;else if(Number.isFinite(o[4].value)&&!Number.isFinite(u[4].value))switch(t){case"down":s=o[4].value<0?-1/0:Object.is(-0,0*o[4].value)?-0:0;break;case"up":s=o[4].value>0?1/0:Object.is(0,0*o[4].value)?0:-0;break;default:s=Object.is(0,0*o[4].value)?0:-0}else if(Number.isFinite(u[4].value))switch(t){case"down":s=Math.floor(o[4].value/u[4].value)*u[4].value;break;case"up":s=Math.ceil(o[4].value/u[4].value)*u[4].value;break;case"to-zero":s=Math.trunc(o[4].value/u[4].value)*u[4].value;break;default:{let l=Math.floor(o[4].value/u[4].value)*u[4].value,d=Math.ceil(o[4].value/u[4].value)*u[4].value;if(l>d){const b=l;l=d,d=b}const f=Math.abs(o[4].value-l),v=Math.abs(o[4].value-d);s=f===v?d:f<v?l:d;break}}else s=o[4].value;else s=Number.NaN;return Q(e,o,s)}function Aa(e,t,n){const r=t.value;return!M(r)||!n.rawPercentages&&D(r)?-1:ue(e,Math.sign(r[4].value))}function Ba(e,t){const n=t.value;if(!Qe(n))return-1;let r=n[4].value;if(A(n))switch(V(n[4].unit)){case"rad":break;case"deg":r=Je.get("rad")(n[4].value);break;case"grad":r=Re.get("rad")(n[4].value);break;case"turn":r=Ue.get("rad")(n[4].value);break;default:return-1}return r=Math.sin(r),ue(e,r)}function xa(e,t){const n=t.value;return N(n)?ue(e,Math.sqrt(n[4].value)):-1}function Ma(e,t){const n=t.value;if(!Qe(n))return-1;const r=n[4].value;let a=0,o=n[4].value;if(A(n))switch(V(n[4].unit)){case"rad":a=jt.get("deg")(r);break;case"deg":a=r,o=Je.get("rad")(r);break;case"grad":a=Re.get("deg")(r),o=Re.get("rad")(r);break;case"turn":a=Ue.get("deg")(r),o=Ue.get("rad")(r);break;default:return-1}const u=a/90;return o=a%90==0&&u%2!=0?u>0?1/0:-1/0:Math.tan(o),ue(e,o)}function Ia(e){if(e.length!==2)return-1;const t=e[0].value;let n=e[1].value;if(N(t)&&N(n)){const r=t[4].value-n[4].value;return new g([i.Number,r.toString(),t[2],n[3],{value:r,type:t[4].type===h.Integer&&n[4].type===h.Integer?h.Integer:h.Number}])}if(D(t)&&D(n)){const r=t[4].value-n[4].value;return new g([i.Percentage,r.toString()+"%",t[2],n[3],{value:r}])}if(A(t)&&A(n)&&(n=X(t,n),V(t[4].unit)===V(n[4].unit))){const r=t[4].value-n[4].value;return new g([i.Dimension,r.toString()+t[4].unit,t[2],n[3],{value:r,type:t[4].type===h.Integer&&n[4].type===h.Integer?h.Integer:h.Number,unit:t[4].unit}])}return-1}function Ha(e,t){if(t.length===1){const n=t[0];if(!n||!m(n))return-1;const r=n.value;return N(r)?ue(e,Math.log(r[4].value)):-1}if(t.length===2){const n=t[0];if(!n||!m(n))return-1;const r=n.value;if(!N(r))return-1;const a=t[1];if(!a||!m(a))return-1;const o=a.value;return N(o)?ue(e,Math.log(r[4].value)/Math.log(o[4].value)):-1}return-1}const Oa=/^none$/i;function kt(e){if(Array.isArray(e)){const n=e.filter(r=>!(J(r)&&$(r)));return n.length===1&&kt(n[0])}if(!m(e))return!1;const t=e.value;return!!H(t)&&Oa.test(t[4].value)}const La=String.fromCodePoint(0);function Ra(e,t,n,r,a,o){if(t.fixed===-1&&!o.randomCaching)return-1;o.randomCaching||(o.randomCaching={propertyName:"",propertyN:0,elementID:"",documentID:""}),o.randomCaching&&!o.randomCaching.propertyN&&(o.randomCaching.propertyN=0);const u=n.value;if(!M(u))return-1;const s=X(u,r.value);if(!le(u,s))return-1;let l=null;if(a&&(l=X(u,a.value),!le(u,l)))return-1;if(!Number.isFinite(u[4].value)||!Number.isFinite(s[4].value)||!Number.isFinite(s[4].value-u[4].value))return Q(e,u,Number.NaN);if(l&&!Number.isFinite(l[4].value))return Q(e,u,u[4].value);const d=t.fixed===-1?Ua(_a([t.dashedIdent?t.dashedIdent:`${o.randomCaching?.propertyName} ${o.randomCaching.propertyN++}`,t.elementShared?"":o.randomCaching.elementID,o.randomCaching.documentID].join(La))):()=>t.fixed;let f=u[4].value,v=s[4].value;if(f>v&&([f,v]=[v,f]),l&&(l[4].value<=0||Math.abs(f-v)/l[4].value>1e10)&&(l=null),l){const E=Math.max(l[4].value/1e3,1e-9),C=[f];let k=0;for(;;){k+=l[4].value;const P=f+k;if(!(P+E<v)){C.push(v);break}if(C.push(P),P+l[4].value-E>v)break}const y=d();return Q(e,u,Number(C[Math.floor(C.length*y)].toFixed(5)))}const b=d();return Q(e,u,Number((b*(v-f)+f).toFixed(5)))}function Ua(e=.34944106645296036,t=.19228640875738723,n=.8784393832007205,r=.04850964319275053){return()=>{const a=((e|=0)+(t|=0)|0)+(r|=0)|0;return r=r+1|0,e=t^t>>>9,t=(n|=0)+(n<<3)|0,n=(n=n<<21|n>>>11)+a|0,(a>>>0)/4294967296}}function _a(e){let t=0,n=0,r=0;t=~t;for(let a=0,o=e.length;a<o;a++)r=255&(t^e.charCodeAt(a)),n=+("0x"+"00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".substring(9*r,9*r+8)),t=t>>>8^n;return~t>>>0}const Ft=new Map([["abs",function(e,t,n){return se(e,t,n,Ca)}],["acos",function(e,t,n){return se(e,t,n,ma)}],["asin",function(e,t,n){return se(e,t,n,ga)}],["atan",function(e,t,n){return se(e,t,n,Na)}],["atan2",function(e,t,n){return et(e,t,n,ba)}],["calc",T],["clamp",function(e,t,n){const r=Se([...e.value.filter(C=>!me(C))],t),a=[],o=[],u=[];{let C=a;for(let k=0;k<r.length;k++){const y=r[k];if(m(y)&&re(y.value)){if(C===u)return-1;if(C===o){C=u;continue}if(C===a){C=o;continue}return-1}C.push(y)}}const s=kt(a),l=kt(u);if(s&&l)return T(Y(o),t,n);const d=q(T(Y(o),t,n));if(d===-1)return-1;if(s){const C=q(T(Y(u),t,n));return C===-1?-1:Qt((f=d,v=C,new L([i.Function,"min(",-1,-1,{value:"min"}],[i.CloseParen,")",-1,-1,void 0],[f,new g([i.Comma,",",-1,-1,void 0]),v])),[d,C],n)}if(l){const C=q(T(Y(a),t,n));return C===-1?-1:$t(Ka(C,d),[C,d],n)}var f,v;const b=q(T(Y(a),t,n));if(b===-1)return-1;const E=q(T(Y(u),t,n));return E===-1?-1:ya(e,b,d,E,n)}],["cos",function(e,t,n){return se(e,t,n,Pa)}],["exp",function(e,t,n){return se(e,t,n,wa)}],["hypot",function(e,t,n){return tt(e,e.value,t,n,Ea)}],["log",function(e,t,n){return tt(e,e.value,t,n,Ha)}],["max",function(e,t,n){return tt(e,e.value,t,n,$t)}],["min",function(e,t,n){return tt(e,e.value,t,n,Qt)}],["mod",function(e,t,n){return et(e,t,n,ka)}],["pow",function(e,t,n){return et(e,t,n,Fa)}],["random",function(e,t,n){const r=qa(e.value.filter(f=>!me(f)),t,n);if(r===-1)return-1;const[a,o]=r,u=en(o,t,n);if(u===-1)return-1;const[s,l,d]=u;return!s||!l?-1:Ra(e,a,s,l,d,n)}],["rem",function(e,t,n){return et(e,t,n,Da)}],["round",function(e,t,n){const r=Se([...e.value.filter(f=>!me(f))],t);let a="",o=!1;const u=[],s=[];{let f=u;for(let v=0;v<r.length;v++){const b=r[v];if(!a&&u.length===0&&s.length===0&&m(b)&&H(b.value)){const E=b.value[4].value.toLowerCase();if(Va.has(E)){a=E;continue}}if(m(b)&&re(b.value)){if(f===s)return-1;if(f===u&&a&&u.length===0)continue;if(f===u){o=!0,f=s;continue}return-1}f.push(b)}}const l=q(T(Y(u),t,n));if(l===-1)return-1;o||s.length!==0||s.push(new g([i.Number,"1",-1,-1,{value:1,type:h.Integer}]));const d=q(T(Y(s),t,n));return d===-1?-1:(a||(a="nearest"),Sa(e,a,l,d,n))}],["sign",function(e,t,n){return se(e,t,n,Aa)}],["sin",function(e,t,n){return se(e,t,n,Ba)}],["sqrt",function(e,t,n){return se(e,t,n,xa)}],["tan",function(e,t,n){return se(e,t,n,Ma)}]]);function T(e,t,n){const r=Se([...e.value.filter(o=>!me(o))],t);if(r.length===1&&m(r[0]))return{inputs:[r[0]],operation:$e};let a=0;for(;a<r.length;){const o=r[a];if(Jr(o)&&Ht(o.startToken)){const u=T(o,t,n);if(u===-1)return-1;r.splice(a,1,u)}else if(j(o)){const u=Ft.get(o.getName().toLowerCase());if(!u)return-1;const s=u(o,t,n);if(s===-1)return-1;r.splice(a,1,s)}else a++}if(a=0,r.length===1&&ge(r[0]))return r[0];for(;a<r.length;){const o=r[a];if(!o||!m(o)&&!ge(o)){a++;continue}const u=r[a+1];if(!u||!m(u)){a++;continue}const s=u.value;if(!ze(s)||s[4].value!=="*"&&s[4].value!=="/"){a++;continue}const l=r[a+2];if(!l||!m(l)&&!ge(l))return-1;s[4].value!=="*"?s[4].value!=="/"?a++:r.splice(a,3,{inputs:[o,l],operation:fa}):r.splice(a,3,{inputs:[o,l],operation:pa})}if(a=0,r.length===1&&ge(r[0]))return r[0];for(;a<r.length;){const o=r[a];if(!o||!m(o)&&!ge(o)){a++;continue}const u=r[a+1];if(!u||!m(u)){a++;continue}const s=u.value;if(!ze(s)||s[4].value!=="+"&&s[4].value!=="-"){a++;continue}const l=r[a+2];if(!l||!m(l)&&!ge(l))return-1;s[4].value!=="+"?s[4].value!=="-"?a++:r.splice(a,3,{inputs:[o,l],operation:Ia}):r.splice(a,3,{inputs:[o,l],operation:ha})}return r.length===1&&ge(r[0])?r[0]:-1}function se(e,t,n,r){const a=Ga(e.value,t,n);return a===-1?-1:r(e,a,n)}function Ga(e,t,n){const r=q(T(Y(Se([...e.filter(a=>!me(a))],t)),t,n));return r===-1?-1:r}function et(e,t,n,r){const a=Ta(e.value,t,n);if(a===-1)return-1;const[o,u]=a;return r(e,o,u,n)}function Ta(e,t,n){const r=Se([...e.filter(l=>!me(l))],t),a=[],o=[];{let l=a;for(let d=0;d<r.length;d++){const f=r[d];if(m(f)&&re(f.value)){if(l===o)return-1;if(l===a){l=o;continue}return-1}l.push(f)}}const u=q(T(Y(a),t,n));if(u===-1)return-1;const s=q(T(Y(o),t,n));return s===-1?-1:[u,s]}function tt(e,t,n,r,a){const o=en(e.value,n,r);return o===-1?-1:a(e,o,r)}function en(e,t,n){const r=Se([...e.filter(o=>!me(o))],t),a=[];{const o=[];let u=[];for(let s=0;s<r.length;s++){const l=r[s];m(l)&&re(l.value)?(o.push(u),u=[]):u.push(l)}o.push(u);for(let s=0;s<o.length;s++){if(o[s].length===0)return-1;const l=q(T(Y(o[s]),t,n));if(l===-1)return-1;a.push(l)}}return a}const Va=new Set(["nearest","up","down","to-zero"]);function qa(e,t,n){const r={isAuto:!1,dashedIdent:"",fixed:-1,elementShared:!1},a=e[0];if(!m(a)||!H(a.value))return[r,e];for(let o=0;o<e.length;o++){const u=e[o];if(!m(u))return-1;if(re(u.value))return[r,e.slice(o+1)];if(!H(u.value))return-1;const s=u.value[4].value.toLowerCase();if(s!=="element-shared")if(s!=="fixed")if(s!=="auto"){if(s.startsWith("--")){if(r.fixed!==-1||r.isAuto)return-1;r.dashedIdent=s}}else{if(r.fixed!==-1||r.dashedIdent)return-1;r.isAuto=!0}else{if(r.elementShared||r.dashedIdent||r.isAuto)return-1;o++;const l=e[o];if(!l)return-1;const d=q(T(Y([l]),t,n));if(d===-1||!N(d.value)||d.value[4].value<0||d.value[4].value>1)return-1;r.fixed=Math.max(0,Math.min(d.value[4].value,1-1e-9))}else{if(r.fixed!==-1)return-1;r.elementShared=!0}}return-1}function Y(e){return new L([i.Function,"calc(",-1,-1,{value:"calc"}],[i.CloseParen,")",-1,-1,void 0],e)}function Ka(e,t){return new L([i.Function,"max(",-1,-1,{value:"max"}],[i.CloseParen,")",-1,-1,void 0],[e,new g([i.Comma,",",-1,-1,void 0]),t])}function Xa(e){if(e===-1)return-1;if(j(e))return e;const t=e.value;return M(t)&&Number.isNaN(t[4].value)?N(t)?new L([i.Function,"calc(",t[2],t[3],{value:"calc"}],[i.CloseParen,")",t[2],t[3],void 0],[new g([i.Ident,"NaN",t[2],t[3],{value:"NaN"}])]):A(t)?new L([i.Function,"calc(",t[2],t[3],{value:"calc"}],[i.CloseParen,")",t[2],t[3],void 0],[new g([i.Ident,"NaN",t[2],t[3],{value:"NaN"}]),new R([[i.Whitespace," ",t[2],t[3],void 0]]),new g([i.Delim,"*",t[2],t[3],{value:"*"}]),new R([[i.Whitespace," ",t[2],t[3],void 0]]),new g([i.Dimension,"1"+t[4].unit,t[2],t[3],{value:1,type:h.Integer,unit:t[4].unit}])]):D(t)?new L([i.Function,"calc(",t[2],t[3],{value:"calc"}],[i.CloseParen,")",t[2],t[3],void 0],[new g([i.Ident,"NaN",t[2],t[3],{value:"NaN"}]),new R([[i.Whitespace," ",t[2],t[3],void 0]]),new g([i.Delim,"*",t[2],t[3],{value:"*"}]),new R([[i.Whitespace," ",t[2],t[3],void 0]]),new g([i.Percentage,"1%",t[2],t[3],{value:1}])]):-1:e}function Ya(e){if(e===-1)return-1;if(j(e))return e;const t=e.value;if(!M(t)||Number.isFinite(t[4].value)||Number.isNaN(t[4].value))return e;let n="";return Number.NEGATIVE_INFINITY===t[4].value&&(n="-"),N(t)?new L([i.Function,"calc(",t[2],t[3],{value:"calc"}],[i.CloseParen,")",t[2],t[3],void 0],[new g([i.Ident,n+"infinity",t[2],t[3],{value:n+"infinity"}])]):A(t)?new L([i.Function,"calc(",t[2],t[3],{value:"calc"}],[i.CloseParen,")",t[2],t[3],void 0],[new g([i.Ident,n+"infinity",t[2],t[3],{value:n+"infinity"}]),new R([[i.Whitespace," ",t[2],t[3],void 0]]),new g([i.Delim,"*",t[2],t[3],{value:"*"}]),new R([[i.Whitespace," ",t[2],t[3],void 0]]),new g([i.Dimension,"1"+t[4].unit,t[2],t[3],{value:1,type:h.Integer,unit:t[4].unit}])]):new L([i.Function,"calc(",t[2],t[3],{value:"calc"}],[i.CloseParen,")",t[2],t[3],void 0],[new g([i.Ident,n+"infinity",t[2],t[3],{value:n+"infinity"}]),new R([[i.Whitespace," ",t[2],t[3],void 0]]),new g([i.Delim,"*",t[2],t[3],{value:"*"}]),new R([[i.Whitespace," ",t[2],t[3],void 0]]),new g([i.Percentage,"1%",t[2],t[3],{value:1}])])}function Wa(e){if(e===-1)return-1;if(j(e))return e;const t=e.value;return M(t)&&Object.is(-0,t[4].value)&&(t[1]==="-0"||(D(t)?t[1]="-0%":A(t)?t[1]="-0"+t[4].unit:t[1]="-0")),e}function za(e,t=13){if(e===-1)return-1;if(t<=0||j(e))return e;const n=e.value;if(!M(n)||Number.isInteger(n[4].value))return e;const r=Number(n[4].value.toFixed(t)).toString();return N(n)?n[1]=r:D(n)?n[1]=r+"%":A(n)&&(n[1]=r+n[4].unit),e}function Za(e){return e===-1?-1:(j(e)||A(e.value)&&(e.value=da(e.value)),e)}function ja(e,t){let n=e;return t?.toCanonicalUnits&&(n=Za(n)),n=za(n,t?.precision),n=Wa(n),t?.censorIntoStandardRepresentableValues||(n=Xa(n),n=Ya(n)),n}function Ja(e){const t=new Map;if(!e)return t;for(const[n,r]of e)if(ct(r))t.set(n,r);else if(typeof r=="string"){const a=Bt({css:r}),o=a.nextToken();if(a.nextToken(),!a.endOfFile()||!M(o))continue;t.set(n,o)}return t}function nt(e,t){const n=Ja(t?.globals);return jr(e,r=>{if(!j(r))return;const a=Ft.get(r.getName().toLowerCase());if(!a)return;const o=ja(q(a(r,n,t??{})),t);return o!==-1?o:void 0})}const rt=new Set(Ft.keys());var c,p;function G(e){return[Number.isNaN(e[0])?0:e[0],Number.isNaN(e[1])?0:e[1],Number.isNaN(e[2])?0:e[2]]}function at(e){switch(e.colorNotation){case c.HEX:case c.RGB:case c.sRGB:return{...e,colorNotation:c.XYZ_D50,channels:mr(G(e.channels))};case c.Linear_sRGB:return{...e,colorNotation:c.XYZ_D50,channels:Sr(G(e.channels))};case c.Display_P3:return{...e,colorNotation:c.XYZ_D50,channels:Mr(G(e.channels))};case c.Rec2020:return{...e,colorNotation:c.XYZ_D50,channels:Hr(G(e.channels))};case c.A98_RGB:return{...e,colorNotation:c.XYZ_D50,channels:Br(G(e.channels))};case c.ProPhoto_RGB:return{...e,colorNotation:c.XYZ_D50,channels:Lr(G(e.channels))};case c.HSL:return{...e,colorNotation:c.XYZ_D50,channels:gr(G(e.channels))};case c.HWB:return{...e,colorNotation:c.XYZ_D50,channels:br(G(e.channels))};case c.Lab:return{...e,colorNotation:c.XYZ_D50,channels:yr(G(e.channels))};case c.OKLab:return{...e,colorNotation:c.XYZ_D50,channels:kr(G(e.channels))};case c.LCH:return{...e,colorNotation:c.XYZ_D50,channels:wr(G(e.channels))};case c.OKLCH:return{...e,colorNotation:c.XYZ_D50,channels:Dr(G(e.channels))};case c.XYZ_D50:return{...e,colorNotation:c.XYZ_D50,channels:G(e.channels)};case c.XYZ_D65:return{...e,colorNotation:c.XYZ_D50,channels:Ur(G(e.channels))};default:throw new Error("Unsupported color notation")}}(function(e){e.A98_RGB="a98-rgb",e.Display_P3="display-p3",e.HEX="hex",e.HSL="hsl",e.HWB="hwb",e.LCH="lch",e.Lab="lab",e.Linear_sRGB="srgb-linear",e.OKLCH="oklch",e.OKLab="oklab",e.ProPhoto_RGB="prophoto-rgb",e.RGB="rgb",e.sRGB="srgb",e.Rec2020="rec2020",e.XYZ_D50="xyz-d50",e.XYZ_D65="xyz-d65"})(c||(c={})),function(e){e.ColorKeyword="color-keyword",e.HasAlpha="has-alpha",e.HasDimensionValues="has-dimension-values",e.HasNoneKeywords="has-none-keywords",e.HasNumberValues="has-number-values",e.HasPercentageAlpha="has-percentage-alpha",e.HasPercentageValues="has-percentage-values",e.HasVariableAlpha="has-variable-alpha",e.Hex="hex",e.LegacyHSL="legacy-hsl",e.LegacyRGB="legacy-rgb",e.NamedColor="named-color",e.RelativeColorSyntax="relative-color-syntax",e.ColorMix="color-mix",e.ContrastColor="contrast-color",e.Experimental="experimental"}(p||(p={}));const tn=new Set([c.A98_RGB,c.Display_P3,c.HEX,c.Linear_sRGB,c.ProPhoto_RGB,c.RGB,c.sRGB,c.Rec2020,c.XYZ_D50,c.XYZ_D65]);function Ae(e,t){const n={...e};if(e.colorNotation!==t){const r=at(n);switch(t){case c.HEX:case c.RGB:n.colorNotation=c.RGB,n.channels=je(r.channels);break;case c.sRGB:n.colorNotation=c.sRGB,n.channels=je(r.channels);break;case c.Linear_sRGB:n.colorNotation=c.Linear_sRGB,n.channels=Ar(r.channels);break;case c.Display_P3:n.colorNotation=c.Display_P3,n.channels=Ir(r.channels);break;case c.Rec2020:n.colorNotation=c.Rec2020,n.channels=Or(r.channels);break;case c.ProPhoto_RGB:n.colorNotation=c.ProPhoto_RGB,n.channels=Rr(r.channels);break;case c.A98_RGB:n.colorNotation=c.A98_RGB,n.channels=xr(r.channels);break;case c.HSL:n.colorNotation=c.HSL,n.channels=Nr(r.channels);break;case c.HWB:n.colorNotation=c.HWB,n.channels=Cr(r.channels);break;case c.Lab:n.colorNotation=c.Lab,n.channels=Pr(r.channels);break;case c.LCH:n.colorNotation=c.LCH,n.channels=Er(r.channels);break;case c.OKLCH:n.colorNotation=c.OKLCH,n.channels=Vt(r.channels);break;case c.OKLab:n.colorNotation=c.OKLab,n.channels=Fr(r.channels);break;case c.XYZ_D50:n.colorNotation=c.XYZ_D50,n.channels=r.channels;break;case c.XYZ_D65:n.colorNotation=c.XYZ_D65,n.channels=_r(r.channels);break;default:throw new Error("Unsupported color notation")}}else n.channels=G(e.channels);if(t===e.colorNotation)n.channels=K(e.channels,[0,1,2],n.channels,[0,1,2]);else if(tn.has(t)&&tn.has(e.colorNotation))n.channels=K(e.channels,[0,1,2],n.channels,[0,1,2]);else switch(t){case c.HSL:switch(e.colorNotation){case c.HWB:n.channels=K(e.channels,[0],n.channels,[0]);break;case c.Lab:case c.OKLab:n.channels=K(e.channels,[2],n.channels,[0]);break;case c.LCH:case c.OKLCH:n.channels=K(e.channels,[0,1,2],n.channels,[2,1,0])}break;case c.HWB:switch(e.colorNotation){case c.HSL:n.channels=K(e.channels,[0],n.channels,[0]);break;case c.LCH:case c.OKLCH:n.channels=K(e.channels,[0],n.channels,[2])}break;case c.Lab:case c.OKLab:switch(e.colorNotation){case c.HSL:n.channels=K(e.channels,[0],n.channels,[2]);break;case c.Lab:case c.OKLab:n.channels=K(e.channels,[0,1,2],n.channels,[0,1,2]);break;case c.LCH:case c.OKLCH:n.channels=K(e.channels,[0],n.channels,[0])}break;case c.LCH:case c.OKLCH:switch(e.colorNotation){case c.HSL:n.channels=K(e.channels,[0,1,2],n.channels,[2,1,0]);break;case c.HWB:n.channels=K(e.channels,[0],n.channels,[2]);break;case c.Lab:case c.OKLab:n.channels=K(e.channels,[0],n.channels,[0]);break;case c.LCH:case c.OKLCH:n.channels=K(e.channels,[0,1,2],n.channels,[0,1,2])}}return n.channels=$a(n.channels,t),n}function $a(e,t){const n=[...e];switch(t){case c.HSL:!Number.isNaN(n[1])&&O(n[1],4)<=0&&(n[0]=Number.NaN);break;case c.HWB:Math.max(0,O(n[1],4))+Math.max(0,O(n[2],4))>=100&&(n[0]=Number.NaN);break;case c.LCH:!Number.isNaN(n[1])&&O(n[1],4)<=0&&(n[2]=Number.NaN);break;case c.OKLCH:!Number.isNaN(n[1])&&O(n[1],6)<=0&&(n[2]=Number.NaN)}return n}function Qa(e,t){const n=[...e];switch(t){case c.HSL:(O(n[2])<=0||O(n[2])>=100)&&(n[0]=Number.NaN,n[1]=Number.NaN),O(n[1])<=0&&(n[0]=Number.NaN);break;case c.HWB:Math.max(0,O(n[1]))+Math.max(0,O(n[2]))>=100&&(n[0]=Number.NaN);break;case c.Lab:(O(n[0])<=0||O(n[0])>=100)&&(n[1]=Number.NaN,n[2]=Number.NaN);break;case c.LCH:O(n[1])<=0&&(n[2]=Number.NaN),(O(n[0])<=0||O(n[0])>=100)&&(n[1]=Number.NaN,n[2]=Number.NaN);break;case c.OKLab:(O(n[0])<=0||O(n[0])>=1)&&(n[1]=Number.NaN,n[2]=Number.NaN);break;case c.OKLCH:O(n[1])<=0&&(n[2]=Number.NaN),(O(n[0])<=0||O(n[0])>=1)&&(n[1]=Number.NaN,n[2]=Number.NaN)}return n}function K(e,t,n,r){const a=[...n];for(const o of t)Number.isNaN(e[t[o]])&&(a[r[o]]=Number.NaN);return a}function nn(e){const t=new Map;switch(e.colorNotation){case c.RGB:case c.HEX:t.set("r",S(255*e.channels[0])),t.set("g",S(255*e.channels[1])),t.set("b",S(255*e.channels[2])),typeof e.alpha=="number"&&t.set("alpha",S(e.alpha));break;case c.HSL:t.set("h",S(e.channels[0])),t.set("s",S(e.channels[1])),t.set("l",S(e.channels[2])),typeof e.alpha=="number"&&t.set("alpha",S(e.alpha));break;case c.HWB:t.set("h",S(e.channels[0])),t.set("w",S(e.channels[1])),t.set("b",S(e.channels[2])),typeof e.alpha=="number"&&t.set("alpha",S(e.alpha));break;case c.Lab:case c.OKLab:t.set("l",S(e.channels[0])),t.set("a",S(e.channels[1])),t.set("b",S(e.channels[2])),typeof e.alpha=="number"&&t.set("alpha",S(e.alpha));break;case c.LCH:case c.OKLCH:t.set("l",S(e.channels[0])),t.set("c",S(e.channels[1])),t.set("h",S(e.channels[2])),typeof e.alpha=="number"&&t.set("alpha",S(e.alpha));break;case c.sRGB:case c.A98_RGB:case c.Display_P3:case c.Rec2020:case c.Linear_sRGB:case c.ProPhoto_RGB:t.set("r",S(e.channels[0])),t.set("g",S(e.channels[1])),t.set("b",S(e.channels[2])),typeof e.alpha=="number"&&t.set("alpha",S(e.alpha));break;case c.XYZ_D50:case c.XYZ_D65:t.set("x",S(e.channels[0])),t.set("y",S(e.channels[1])),t.set("z",S(e.channels[2])),typeof e.alpha=="number"&&t.set("alpha",S(e.alpha))}return t}function rn(e){const t=new Map(e);for(const[n,r]of e)Number.isNaN(r[4].value)&&t.set(n,S(0));return t}function S(e){return Number.isNaN(e)?[i.Number,"none",-1,-1,{value:Number.NaN,type:h.Number}]:[i.Number,e.toString(),-1,-1,{value:e,type:h.Number}]}function O(e,t=7){if(Number.isNaN(e))return 0;const n=Math.pow(10,t);return Math.round(e*n)/n}function w(e,t,n,r){return Math.min(Math.max(e/t,n),r)}const eo=/[A-Z]/g;function x(e){return e.replace(eo,t=>String.fromCharCode(t.charCodeAt(0)+32))}function Ge(e,t,n){if(H(e)&&x(e[4].value)==="none")return n.syntaxFlags.add(p.HasNoneKeywords),[i.Number,"none",e[2],e[3],{value:Number.NaN,type:h.Number}];if(D(e)){t!==3&&n.syntaxFlags.add(p.HasPercentageValues);let r=w(e[4].value,100,-2147483647,2147483647);return t===3&&(r=w(e[4].value,100,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}if(N(e)){t!==3&&n.syntaxFlags.add(p.HasNumberValues);let r=w(e[4].value,1,-2147483647,2147483647);return t===3&&(r=w(e[4].value,1,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}return!1}const to=new Set(["srgb","srgb-linear","display-p3","a98-rgb","prophoto-rgb","rec2020","xyz","xyz-d50","xyz-d65"]);function no(e,t){const n=[],r=[],a=[],o=[];let u,s,l=!1,d=!1;const f={colorNotation:c.sRGB,channels:[0,0,0],alpha:1,syntaxFlags:new Set([])};let v=n;for(let y=0;y<e.value.length;y++){let P=e.value[y];if(J(P)||$(P))for(;J(e.value[y+1])||$(e.value[y+1]);)y++;else if(v===n&&n.length&&(v=r),v===r&&r.length&&(v=a),m(P)&&ze(P.value)&&P.value[4].value==="/"){if(v===o)return!1;v=o}else{if(j(P)){if(v===o&&x(P.getName())==="var"){f.syntaxFlags.add(p.HasVariableAlpha),v.push(P);continue}if(!rt.has(x(P.getName())))return!1;const[[F]]=nt([[P]],{censorIntoStandardRepresentableValues:!0,globals:s,precision:-1,toCanonicalUnits:!0,rawPercentages:!0});if(!F||!m(F)||!M(F.value))return!1;Number.isNaN(F.value[4].value)&&(F.value[4].value=0),P=F}if(v===n&&n.length===0&&m(P)&&H(P.value)&&to.has(x(P.value[4].value))){if(l)return!1;l=x(P.value[4].value),f.colorNotation=ro(l),d&&(d.colorNotation!==f.colorNotation&&(d=Ae(d,f.colorNotation)),u=nn(d),s=rn(u))}else if(v===n&&n.length===0&&m(P)&&H(P.value)&&x(P.value[4].value)==="from"){if(d||l)return!1;for(;J(e.value[y+1])||$(e.value[y+1]);)y++;if(y++,P=e.value[y],d=t(P),d===!1)return!1;d.syntaxFlags.has(p.Experimental)&&f.syntaxFlags.add(p.Experimental),f.syntaxFlags.add(p.RelativeColorSyntax)}else{if(!m(P))return!1;if(H(P.value)&&u&&u.has(x(P.value[4].value))){v.push(new g(u.get(x(P.value[4].value))));continue}v.push(P)}}}if(!l||v.length!==1||n.length!==1||r.length!==1||a.length!==1||!m(n[0])||!m(r[0])||!m(a[0])||u&&!u.has("alpha"))return!1;const b=Ge(n[0].value,0,f);if(!b||!N(b))return!1;const E=Ge(r[0].value,1,f);if(!E||!N(E))return!1;const C=Ge(a[0].value,2,f);if(!C||!N(C))return!1;const k=[b,E,C];if(o.length===1)if(f.syntaxFlags.add(p.HasAlpha),m(o[0])){const y=Ge(o[0].value,3,f);if(!y||!N(y))return!1;k.push(y)}else f.alpha=o[0];else if(u&&u.has("alpha")){const y=Ge(u.get("alpha"),3,f);if(!y||!N(y))return!1;k.push(y)}return f.channels=[k[0][4].value,k[1][4].value,k[2][4].value],k.length===4&&(f.alpha=k[3][4].value),f}function ro(e){switch(e){case"srgb":return c.sRGB;case"srgb-linear":return c.Linear_sRGB;case"display-p3":return c.Display_P3;case"a98-rgb":return c.A98_RGB;case"prophoto-rgb":return c.ProPhoto_RGB;case"rec2020":return c.Rec2020;case"xyz":case"xyz-d65":return c.XYZ_D65;case"xyz-d50":return c.XYZ_D50;default:throw new Error("Unknown color space name: "+e)}}const ao=new Set(["srgb","srgb-linear","display-p3","a98-rgb","prophoto-rgb","rec2020","lab","oklab","xyz","xyz-d50","xyz-d65"]),Dt=new Set(["hsl","hwb","lch","oklch"]),oo=new Set(["shorter","longer","increasing","decreasing"]);function uo(e,t){let n=null,r=null,a=null,o=!1;for(let u=0;u<e.value.length;u++){const s=e.value[u];if(!J(s)&&!$(s)){if(m(s)&&H(s.value)){if(!n&&x(s.value[4].value)==="in"){n=s;continue}if(n&&!r){r=x(s.value[4].value);continue}if(n&&r&&!a&&Dt.has(r)){a=x(s.value[4].value);continue}if(n&&r&&a&&!o&&x(s.value[4].value)==="hue"){o=!0;continue}return!1}return!(!m(s)||!re(s.value))&&!!r&&(a||o?!!(r&&a&&o&&Dt.has(r)&&oo.has(a))&&an(r,a,St(e.value.slice(u+1),t)):ao.has(r)?so(r,St(e.value.slice(u+1),t)):!!Dt.has(r)&&an(r,"shorter",St(e.value.slice(u+1),t)))}}return!1}function St(e,t){const n=[];let r=1,a=!1,o=!1;for(let l=0;l<e.length;l++){let d=e[l];if(!J(d)&&!$(d)){if(!m(d)||!re(d.value)){if(!a){const f=t(d);if(f){a=f;continue}}if(!o){if(j(d)&&rt.has(x(d.getName()))){if([[d]]=nt([[d]],{censorIntoStandardRepresentableValues:!0,precision:-1,toCanonicalUnits:!0,rawPercentages:!0}),!d||!m(d)||!M(d.value))return!1;Number.isNaN(d.value[4].value)&&(d.value[4].value=0)}if(m(d)&&D(d.value)&&d.value[4].value>=0){o=d.value[4].value;continue}}return!1}if(!a)return!1;n.push({color:a,percentage:o}),a=!1,o=!1}}if(a&&n.push({color:a,percentage:o}),n.length!==2)return!1;let u=n[0].percentage,s=n[1].percentage;return(u===!1||!(u<0||u>100))&&(s===!1||!(s<0||s>100))&&(u===!1&&s===!1?(u=50,s=50):u!==!1&&s===!1?s=100-u:u===!1&&s!==!1&&(u=100-s),(u!==0||s!==0)&&u!==!1&&s!==!1&&(u+s>100&&(u=u/(u+s)*100,s=s/(u+s)*100),u+s<100&&(r=(u+s)/100,u=u/(u+s)*100,s=s/(u+s)*100),{a:{color:n[0].color,percentage:u},b:{color:n[1].color,percentage:s},alphaMultiplier:r}))}function so(e,t){if(!t)return!1;const n=t.a.color,r=t.b.color,a=t.a.percentage/100;let o=n.channels,u=r.channels,s=c.RGB,l=n.alpha;if(typeof l!="number")return!1;let d=r.alpha;if(typeof d!="number")return!1;switch(l=Number.isNaN(l)?d:l,d=Number.isNaN(d)?l:d,e){case"srgb":s=c.RGB;break;case"srgb-linear":s=c.Linear_sRGB;break;case"display-p3":s=c.Display_P3;break;case"a98-rgb":s=c.A98_RGB;break;case"prophoto-rgb":s=c.ProPhoto_RGB;break;case"rec2020":s=c.Rec2020;break;case"lab":s=c.Lab;break;case"oklab":s=c.OKLab;break;case"xyz-d50":s=c.XYZ_D50;break;case"xyz":case"xyz-d65":s=c.XYZ_D65}o=Ae(n,s).channels,u=Ae(r,s).channels,o[0]=ee(o[0],u[0]),u[0]=ee(u[0],o[0]),o[1]=ee(o[1],u[1]),u[1]=ee(u[1],o[1]),o[2]=ee(o[2],u[2]),u[2]=ee(u[2],o[2]),o[0]=ie(o[0],l),o[1]=ie(o[1],l),o[2]=ie(o[2],l),u[0]=ie(u[0],d),u[1]=ie(u[1],d),u[2]=ie(u[2],d);const f=te(l,d,a),v={colorNotation:s,channels:[Ne(te(o[0],u[0],a),f),Ne(te(o[1],u[1],a),f),Ne(te(o[2],u[2],a),f)],alpha:f*t.alphaMultiplier,syntaxFlags:new Set([p.ColorMix])};return(t.a.color.syntaxFlags.has(p.Experimental)||t.b.color.syntaxFlags.has(p.Experimental))&&v.syntaxFlags.add(p.Experimental),v}function an(e,t,n){if(!n)return!1;const r=n.a.color,a=n.b.color,o=n.a.percentage/100;let u=r.channels,s=a.channels,l=0,d=0,f=0,v=0,b=0,E=0,C=c.RGB,k=r.alpha;if(typeof k!="number")return!1;let y=a.alpha;if(typeof y!="number")return!1;switch(k=Number.isNaN(k)?y:k,y=Number.isNaN(y)?k:y,e){case"hsl":C=c.HSL;break;case"hwb":C=c.HWB;break;case"lch":C=c.LCH;break;case"oklch":C=c.OKLCH}switch(u=Ae(r,C).channels,s=Ae(a,C).channels,e){case"hsl":case"hwb":l=u[0],d=s[0],f=u[1],v=s[1],b=u[2],E=s[2];break;case"lch":case"oklch":f=u[0],v=s[0],b=u[1],E=s[1],l=u[2],d=s[2]}l=ee(l,d),Number.isNaN(l)&&(l=0),d=ee(d,l),Number.isNaN(d)&&(d=0),f=ee(f,v),v=ee(v,f),b=ee(b,E),E=ee(E,b);const P=d-l;switch(t){case"shorter":P>180?l+=360:P<-180&&(d+=360);break;case"longer":-180<P&&P<180&&(P>0?l+=360:d+=360);break;case"increasing":P<0&&(d+=360);break;case"decreasing":P>0&&(l+=360);break;default:throw new Error("Unknown hue interpolation method")}f=ie(f,k),b=ie(b,k),v=ie(v,y),E=ie(E,y);let F=[0,0,0];const B=te(k,y,o);switch(e){case"hsl":case"hwb":F=[te(l,d,o),Ne(te(f,v,o),B),Ne(te(b,E,o),B)];break;case"lch":case"oklch":F=[Ne(te(f,v,o),B),Ne(te(b,E,o),B),te(l,d,o)]}const W={colorNotation:C,channels:F,alpha:B*n.alphaMultiplier,syntaxFlags:new Set([p.ColorMix])};return(n.a.color.syntaxFlags.has(p.Experimental)||n.b.color.syntaxFlags.has(p.Experimental))&&W.syntaxFlags.add(p.Experimental),W}function ee(e,t){return Number.isNaN(e)?t:e}function te(e,t,n){return e*n+t*(1-n)}function ie(e,t){return Number.isNaN(t)?e:Number.isNaN(e)?Number.NaN:e*t}function Ne(e,t){return t===0||Number.isNaN(t)?e:Number.isNaN(e)?Number.NaN:e/t}function io(e){const t=x(e[4].value);if(t.match(/[^a-f0-9]/))return!1;const n={colorNotation:c.HEX,channels:[0,0,0],alpha:1,syntaxFlags:new Set([p.Hex])},r=t.length;if(r===3){const a=t[0],o=t[1],u=t[2];return n.channels=[parseInt(a+a,16)/255,parseInt(o+o,16)/255,parseInt(u+u,16)/255],n}if(r===6){const a=t[0]+t[1],o=t[2]+t[3],u=t[4]+t[5];return n.channels=[parseInt(a,16)/255,parseInt(o,16)/255,parseInt(u,16)/255],n}if(r===4){const a=t[0],o=t[1],u=t[2],s=t[3];return n.channels=[parseInt(a+a,16)/255,parseInt(o+o,16)/255,parseInt(u+u,16)/255],n.alpha=parseInt(s+s,16)/255,n.syntaxFlags.add(p.HasAlpha),n}if(r===8){const a=t[0]+t[1],o=t[2]+t[3],u=t[4]+t[5],s=t[6]+t[7];return n.channels=[parseInt(a,16)/255,parseInt(o,16)/255,parseInt(u,16)/255],n.alpha=parseInt(s,16)/255,n.syntaxFlags.add(p.HasAlpha),n}return!1}function Te(e){if(N(e))return e[4].value=e[4].value%360,e[1]=e[4].value.toString(),e;if(A(e)){let t=e[4].value;switch(x(e[4].unit)){case"deg":break;case"rad":t=180*e[4].value/Math.PI;break;case"grad":t=.9*e[4].value;break;case"turn":t=360*e[4].value;break;default:return!1}return t%=360,[i.Number,t.toString(),e[2],e[3],{value:t,type:h.Number}]}return!1}function co(e,t,n){if(t===0){const r=Te(e);return r!==!1&&(A(e)&&n.syntaxFlags.add(p.HasDimensionValues),r)}if(D(e)){t===3?n.syntaxFlags.add(p.HasPercentageAlpha):n.syntaxFlags.add(p.HasPercentageValues);let r=w(e[4].value,1,0,100);return t===3&&(r=w(e[4].value,100,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}if(N(e)){if(t!==3)return!1;let r=w(e[4].value,1,0,100);return t===3&&(r=w(e[4].value,1,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}return!1}function lo(e,t,n){if(H(e)&&x(e[4].value)==="none")return n.syntaxFlags.add(p.HasNoneKeywords),[i.Number,"none",e[2],e[3],{value:Number.NaN,type:h.Number}];if(t===0){const r=Te(e);return r!==!1&&(A(e)&&n.syntaxFlags.add(p.HasDimensionValues),r)}if(D(e)){t===3?n.syntaxFlags.add(p.HasPercentageAlpha):n.syntaxFlags.add(p.HasPercentageValues);let r=e[4].value;return t===3?r=w(e[4].value,100,0,1):t===1&&(r=w(e[4].value,1,0,2147483647)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}if(N(e)){t!==3&&n.syntaxFlags.add(p.HasNumberValues);let r=e[4].value;return t===3?r=w(e[4].value,1,0,1):t===1&&(r=w(e[4].value,1,0,2147483647)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}return!1}function on(e,t,n,r){const a=[],o=[],u=[],s=[],l={colorNotation:n,channels:[0,0,0],alpha:1,syntaxFlags:new Set(r)};let d=a;for(let C=0;C<e.value.length;C++){let k=e.value[C];if(!J(k)&&!$(k)){if(m(k)&&re(k.value)){if(d===a){d=o;continue}if(d===o){d=u;continue}if(d===u){d=s;continue}if(d===s)return!1}if(j(k)){if(d===s&&k.getName().toLowerCase()==="var"){l.syntaxFlags.add(p.HasVariableAlpha),d.push(k);continue}if(!rt.has(k.getName().toLowerCase()))return!1;const[[y]]=nt([[k]],{censorIntoStandardRepresentableValues:!0,precision:-1,toCanonicalUnits:!0,rawPercentages:!0});if(!y||!m(y)||!M(y.value))return!1;Number.isNaN(y.value[4].value)&&(y.value[4].value=0),k=y}if(!m(k))return!1;d.push(k)}}if(d.length!==1||a.length!==1||o.length!==1||u.length!==1||!m(a[0])||!m(o[0])||!m(u[0]))return!1;const f=t(a[0].value,0,l);if(!f||!N(f))return!1;const v=t(o[0].value,1,l);if(!v||!N(v))return!1;const b=t(u[0].value,2,l);if(!b||!N(b))return!1;const E=[f,v,b];if(s.length===1)if(l.syntaxFlags.add(p.HasAlpha),m(s[0])){const C=t(s[0].value,3,l);if(!C||!N(C))return!1;E.push(C)}else l.alpha=s[0];return l.channels=[E[0][4].value,E[1][4].value,E[2][4].value],E.length===4&&(l.alpha=E[3][4].value),l}function be(e,t,n,r,a){const o=[],u=[],s=[],l=[];let d,f,v=!1;const b={colorNotation:n,channels:[0,0,0],alpha:1,syntaxFlags:new Set(r)};let E=o;for(let F=0;F<e.value.length;F++){let B=e.value[F];if(J(B)||$(B))for(;J(e.value[F+1])||$(e.value[F+1]);)F++;else if(E===o&&o.length&&(E=u),E===u&&u.length&&(E=s),m(B)&&ze(B.value)&&B.value[4].value==="/"){if(E===l)return!1;E=l}else{if(j(B)){if(E===l&&B.getName().toLowerCase()==="var"){b.syntaxFlags.add(p.HasVariableAlpha),E.push(B);continue}if(!rt.has(B.getName().toLowerCase()))return!1;const[[W]]=nt([[B]],{censorIntoStandardRepresentableValues:!0,globals:f,precision:-1,toCanonicalUnits:!0,rawPercentages:!0});if(!W||!m(W)||!M(W.value))return!1;Number.isNaN(W.value[4].value)&&(W.value[4].value=0),B=W}if(E===o&&o.length===0&&m(B)&&H(B.value)&&B.value[4].value.toLowerCase()==="from"){if(v)return!1;for(;J(e.value[F+1])||$(e.value[F+1]);)F++;if(F++,B=e.value[F],v=a(B),v===!1)return!1;v.syntaxFlags.has(p.Experimental)&&b.syntaxFlags.add(p.Experimental),b.syntaxFlags.add(p.RelativeColorSyntax),v.colorNotation!==n&&(v=Ae(v,n)),d=nn(v),f=rn(d)}else{if(!m(B))return!1;if(H(B.value)&&d){const W=B.value[4].value.toLowerCase();if(d.has(W)){E.push(new g(d.get(W)));continue}}E.push(B)}}}if(E.length!==1||o.length!==1||u.length!==1||s.length!==1||!m(o[0])||!m(u[0])||!m(s[0])||d&&!d.has("alpha"))return!1;const C=t(o[0].value,0,b);if(!C||!N(C))return!1;const k=t(u[0].value,1,b);if(!k||!N(k))return!1;const y=t(s[0].value,2,b);if(!y||!N(y))return!1;const P=[C,k,y];if(l.length===1)if(b.syntaxFlags.add(p.HasAlpha),m(l[0])){const F=t(l[0].value,3,b);if(!F||!N(F))return!1;P.push(F)}else b.alpha=l[0];else if(d&&d.has("alpha")){const F=t(d.get("alpha"),3,b);if(!F||!N(F))return!1;P.push(F)}return b.channels=[P[0][4].value,P[1][4].value,P[2][4].value],P.length===4&&(b.alpha=P[3][4].value),b}function ho(e,t){if(e.value.some(n=>m(n)&&re(n.value))){const n=fo(e);if(n!==!1)return n}{const n=po(e,t);if(n!==!1)return n}return!1}function fo(e){return on(e,co,c.HSL,[p.LegacyHSL])}function po(e,t){return be(e,lo,c.HSL,[],t)}function vo(e,t,n){if(H(e)&&x(e[4].value)==="none")return n.syntaxFlags.add(p.HasNoneKeywords),[i.Number,"none",e[2],e[3],{value:Number.NaN,type:h.Number}];if(t===0){const r=Te(e);return r!==!1&&(A(e)&&n.syntaxFlags.add(p.HasDimensionValues),r)}if(D(e)){t===3?n.syntaxFlags.add(p.HasPercentageAlpha):n.syntaxFlags.add(p.HasPercentageValues);let r=e[4].value;return t===3&&(r=w(e[4].value,100,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}if(N(e)){t!==3&&n.syntaxFlags.add(p.HasNumberValues);let r=e[4].value;return t===3&&(r=w(e[4].value,1,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}return!1}function mo(e,t,n){if(H(e)&&x(e[4].value)==="none")return n.syntaxFlags.add(p.HasNoneKeywords),[i.Number,"none",e[2],e[3],{value:Number.NaN,type:h.Number}];if(D(e)){t!==3&&n.syntaxFlags.add(p.HasPercentageValues);let r=w(e[4].value,1,0,100);return t===1||t===2?r=w(e[4].value,.8,-2147483647,2147483647):t===3&&(r=w(e[4].value,100,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}if(N(e)){t!==3&&n.syntaxFlags.add(p.HasNumberValues);let r=w(e[4].value,1,0,100);return t===1||t===2?r=w(e[4].value,1,-2147483647,2147483647):t===3&&(r=w(e[4].value,1,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}return!1}function go(e,t){return be(e,mo,c.Lab,[],t)}function No(e,t,n){if(H(e)&&x(e[4].value)==="none")return n.syntaxFlags.add(p.HasNoneKeywords),[i.Number,"none",e[2],e[3],{value:Number.NaN,type:h.Number}];if(t===2){const r=Te(e);return r!==!1&&(A(e)&&n.syntaxFlags.add(p.HasDimensionValues),r)}if(D(e)){t!==3&&n.syntaxFlags.add(p.HasPercentageValues);let r=w(e[4].value,1,0,100);return t===1?r=w(e[4].value,100/150,0,2147483647):t===3&&(r=w(e[4].value,100,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}if(N(e)){t!==3&&n.syntaxFlags.add(p.HasNumberValues);let r=w(e[4].value,1,0,100);return t===1?r=w(e[4].value,1,0,2147483647):t===3&&(r=w(e[4].value,1,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}return!1}function bo(e,t){return be(e,No,c.LCH,[],t)}const un=new Map;for(const[e,t]of Object.entries(qr))un.set(e,t);function Co(e){const t=un.get(x(e));return!!t&&{colorNotation:c.RGB,channels:[t[0]/255,t[1]/255,t[2]/255],alpha:1,syntaxFlags:new Set([p.ColorKeyword,p.NamedColor])}}function yo(e,t,n){if(H(e)&&x(e[4].value)==="none")return n.syntaxFlags.add(p.HasNoneKeywords),[i.Number,"none",e[2],e[3],{value:Number.NaN,type:h.Number}];if(D(e)){t!==3&&n.syntaxFlags.add(p.HasPercentageValues);let r=w(e[4].value,100,0,1);return t===1||t===2?r=w(e[4].value,250,-2147483647,2147483647):t===3&&(r=w(e[4].value,100,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}if(N(e)){t!==3&&n.syntaxFlags.add(p.HasNumberValues);let r=w(e[4].value,1,0,1);return t===1||t===2?r=w(e[4].value,1,-2147483647,2147483647):t===3&&(r=w(e[4].value,1,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}return!1}function Po(e,t){return be(e,yo,c.OKLab,[],t)}function wo(e,t,n){if(H(e)&&x(e[4].value)==="none")return n.syntaxFlags.add(p.HasNoneKeywords),[i.Number,"none",e[2],e[3],{value:Number.NaN,type:h.Number}];if(t===2){const r=Te(e);return r!==!1&&(A(e)&&n.syntaxFlags.add(p.HasDimensionValues),r)}if(D(e)){t!==3&&n.syntaxFlags.add(p.HasPercentageValues);let r=w(e[4].value,100,0,1);return t===1?r=w(e[4].value,250,0,2147483647):t===3&&(r=w(e[4].value,100,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}if(N(e)){t!==3&&n.syntaxFlags.add(p.HasNumberValues);let r=w(e[4].value,1,0,1);return t===1?r=w(e[4].value,1,0,2147483647):t===3&&(r=w(e[4].value,1,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}return!1}function Eo(e,t){return be(e,wo,c.OKLCH,[],t)}function ko(e,t,n){if(D(e)){t===3?n.syntaxFlags.add(p.HasPercentageAlpha):n.syntaxFlags.add(p.HasPercentageValues);const r=w(e[4].value,100,0,1);return[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}if(N(e)){t!==3&&n.syntaxFlags.add(p.HasNumberValues);let r=w(e[4].value,255,0,1);return t===3&&(r=w(e[4].value,1,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}return!1}function Fo(e,t,n){if(H(e)&&e[4].value.toLowerCase()==="none")return n.syntaxFlags.add(p.HasNoneKeywords),[i.Number,"none",e[2],e[3],{value:Number.NaN,type:h.Number}];if(D(e)){t!==3&&n.syntaxFlags.add(p.HasPercentageValues);let r=w(e[4].value,100,-2147483647,2147483647);return t===3&&(r=w(e[4].value,100,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}if(N(e)){t!==3&&n.syntaxFlags.add(p.HasNumberValues);let r=w(e[4].value,255,-2147483647,2147483647);return t===3&&(r=w(e[4].value,1,0,1)),[i.Number,r.toString(),e[2],e[3],{value:r,type:h.Number}]}return!1}function Do(e,t){if(e.value.some(n=>m(n)&&re(n.value))){const n=So(e);if(n!==!1)return(!n.syntaxFlags.has(p.HasNumberValues)||!n.syntaxFlags.has(p.HasPercentageValues))&&n}else{const n=Ao(e,t);if(n!==!1)return n}return!1}function So(e){return on(e,ko,c.RGB,[p.LegacyRGB])}function Ao(e,t){return be(e,Fo,c.RGB,[],t)}function sn(e){const t=je(e);if(Gr(t))return qt(t);let n=e;return n=Vt(n),n[0]<1e-6&&(n=[0,0,0]),n[0]>.999999&&(n=[1,0,0]),Oe(Tr(n,Bo,xo))}function Bo(e){return e=Rt(e),e=ht(e),He(e)}function xo(e){return e=Le(e),e=pt(e),Ut(e)}function Mo(e,t){let n=!1;for(let u=0;u<e.value.length;u++){const s=e.value[u];if(!J(s)&&!$(s)&&(n||(n=t(s),!n)))return!1}if(!n)return!1;n.channels=G(n.channels),n.channels=sn(at(n).channels),n.colorNotation=c.sRGB;const r={colorNotation:c.sRGB,channels:[0,0,0],alpha:1,syntaxFlags:new Set([p.ContrastColor,p.Experimental])},a=Xt(n.channels,[1,1,1]),o=Xt(n.channels,[0,0,0]);return r.channels=a>o?[1,1,1]:[0,0,0],r}function Be(e,t=7){e=+e,t=+t;const n=(Math.floor(Math.abs(e))+"").length;if(t>n)return+e.toFixed(t-n);{const r=10**(n-t);return Math.round(e/r)*r}}function Io(e,t=!0){e.channels=Qa(e.channels,e.colorNotation);let n=e.channels.map(f=>Number.isNaN(f)?0:f);n=t?sn(at(e).channels):je(at(e).channels);const r=Math.min(255,Math.max(0,Math.round(255*Be(n[0])))),a=Math.min(255,Math.max(0,Math.round(255*Be(n[1])))),o=Math.min(255,Math.max(0,Math.round(255*Be(n[2])))),u=[i.CloseParen,")",-1,-1,void 0],s=[i.Whitespace," ",-1,-1,void 0],l=[i.Comma,",",-1,-1,void 0],d=[new g([i.Number,r.toString(),-1,-1,{value:Math.min(255,255*Math.max(0,n[0])),type:h.Integer}]),new g(l),new R([s]),new g([i.Number,a.toString(),-1,-1,{value:Math.min(255,255*Math.max(0,n[1])),type:h.Integer}]),new g(l),new R([s]),new g([i.Number,o.toString(),-1,-1,{value:Math.min(255,255*Math.max(0,n[2])),type:h.Integer}])];if(typeof e.alpha=="number"){const f=Math.min(1,Math.max(0,Be(Number.isNaN(e.alpha)?0:e.alpha)));return Be(f,4)===1?new L([i.Function,"rgb(",-1,-1,{value:"rgb"}],u,d):new L([i.Function,"rgba(",-1,-1,{value:"rgba"}],u,[...d,new g(l),new R([s]),new g([i.Number,Be(f,4).toString(),-1,-1,{value:e.alpha,type:h.Number}])])}return new L([i.Function,"rgba(",-1,-1,{value:"rgba"}],u,[...d,new g(l),new R([s]),e.alpha])}function ne(e){if(j(e))switch(x(e.getName())){case"rgb":case"rgba":return Do(e,ne);case"hsl":case"hsla":return ho(e,ne);case"hwb":return t=ne,be(e,vo,c.HWB,[],t);case"lab":return go(e,ne);case"lch":return bo(e,ne);case"oklab":return Po(e,ne);case"oklch":return Eo(e,ne);case"color":return no(e,ne);case"color-mix":return uo(e,ne);case"contrast-color":return Mo(e,ne)}var t;if(m(e)){if(On(e.value))return io(e.value);if(H(e.value)){const n=Co(e.value[4].value);return n!==!1?n:x(e.value[4].value)==="transparent"&&{colorNotation:c.RGB,channels:[0,0,0],alpha:0,syntaxFlags:new Set([p.ColorKeyword])}}}return!1}const Ho=/^rgba?\(\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)(?:\s*,\s*(-?\d+(?:\.\d+)?))?\s*\)$/i;function Oo(e){try{const t=Wr(Bn({css:e}));if(!t)return null;const n=ne(t);if(!n||typeof n.alpha!="number")return null;const r=Io(n,!0).toString().match(Ho);return r?{r:Math.round(Number.parseFloat(r[1])),g:Math.round(Number.parseFloat(r[2])),b:Math.round(Number.parseFloat(r[3])),a:Math.max(0,Math.min(1,n.alpha))}:null}catch{return null}}export{Oo as parseCssColorFull};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i="Revise Agent",l="Anonymous";function p(e){const n=e?.trim();return!n||n===i}function c(e){return e?.paragraphStyles.find(n=>n.default)}function f(e,n){if(!e)return;const t=e.paragraphStyles.filter(o=>o.headingLevel===n);if(t.length!==0)return t.find(o=>o.styleId.toLowerCase()===`heading${n}`)??t[0]}function d(e,n){return e?.paragraphStyles.find(t=>t.styleId===n)}function u(e,n){return n===void 0?c(e):f(e,n)}const y=["align","lineSpacing","spaceBefore","spaceAfter","contextualSpacing","keepNext","keepLines","widowControl","leftIndent","firstLineIndent","direction","borders","shading","tabStops"];function g(e,n){if(n)for(const t of e){if(t.type!=="paragraph")continue;const o=t.styleId?d(n,t.styleId):t.heading?f(n,t.heading):void 0;if(!o)continue;t.heading&&!t.styleId&&o.styleId.toLowerCase()!=="normal"&&(t.styleId=o.styleId);const r=o.paragraphAttrs??{},a=t;for(const s of y)Object.prototype.hasOwnProperty.call(r,s)&&r[s]!==void 0&&a[s]===void 0&&(a[s]=r[s]);if(o.runMarks)for(const s of t.children)s.type==="text"&&(s.marks={...o.runMarks,...s.marks})}}function h(e,n){const t=new Set(["fontSize"]);for(const r of Object.keys(e??{}))t.add(r);for(const r of Object.keys(n??{}))t.add(r);const o={};for(const r of t){const a=n?.[r];o[r]=a===void 0?!1:a}return o}export{l as A,i as R,g as a,d as b,u as c,h as d,p as i,c as s};
|