@svgsketch/core 6.3.0 → 6.4.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/dist/index.d.mts +35 -33
- package/dist/index.d.ts +35 -33
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -38,7 +38,7 @@ ${c}
|
|
|
38
38
|
`);return S&&(o.rawMetadata=S),JL(o)}function ik(e){let t=[],n=[...e.children].reverse();for(;n.length>0;){let r=n.pop();r.kind==="element"&&(t.push(r),n.push(...[...r.children].reverse()))}return t}function ok(e,t,n){return zg(e,t,n)?.value??null}function t_(e){let t=e.toLowerCase();return t.includes("publicdomain")||t.includes("cc0")?"cc0":t.includes("by-nc-nd")?"cc-by-nc-nd":t.includes("by-nc-sa")?"cc-by-nc-sa":t.includes("by-nc")?"cc-by-nc":t.includes("by-nd")?"cc-by-nd":t.includes("by-sa")?"cc-by-sa":t.includes("/by/")||t.includes("attribution")?"cc-by":t.includes("mit")?"mit":t.includes("apache")?"apache-2.0":"custom"}function n_(e){let t=e.flatMap(f=>ik(f).filter(p=>p.namespaceUri===Is&&p.localName==="Description")),n=t.find(f=>ok(f,"managed",go)==="true")??t[0];if(!n)return{};let r={},i=ik(n),o=i.find(f=>f.namespaceUri===_n&&f.localName==="creator");o?.children.length&&(r.author=yo(o).trim());let s=i.find(f=>f.namespaceUri===_n&&f.localName==="subject");if(s){let f=yo(s).split(",").map(p=>p.trim()).filter(Boolean);f.length>0&&(r.keywords=f)}let a=i.find(f=>f.namespaceUri===ho&&f.localName==="license"),c=i.find(f=>f.namespaceUri===_n&&f.localName==="rights"),l=a?ok(a,"resource",Is)??yo(a).trim():c?yo(c).trim():"";l&&(r.license=t_(l),r.license==="custom"&&(r.licenseUrl=l));let d={},u=n.children.filter(f=>f.kind==="element");for(let f of u){if(f.namespaceUri===go&&f.localName==="custom"){let h=E(f,"key");h!==null&&(d[h]=E(f,"value")??"");continue}let p=f.namespaceUri??"";if(Jd.has(`${p}|${f.localName}`))continue;let m=WL[p];if(!m)continue;let g=`${m}:${f.localName}`;g in d||(d[g]=yo(f).trim())}if(Object.keys(d).length===0)for(let f of u){if(f.namespaceUri!==_n||f.localName!=="description")continue;let p=yo(f),m=p.indexOf(":");if(m<=0)continue;let g=p.slice(0,m).trim();g&&(d[g]=p.slice(m+1).trim())}return Object.keys(d).length>0&&(r.customMetadata=d),r}function r_(e){let t=e.root,n=dk(e,t),r=lk(t,"metadata"),i=n_(r);n.length>0&&(i.descriptiveElements=uk(n));let o=Fg(t);o!==null&&(i.language=o);let s=E(t,"role");s&&(i.role=s);let a=E(t,"aria-label");a&&(i.ariaLabel=a);let c={};for(let m of t.attributes)m.namespaceUri===null&&m.name.startsWith("aria-")&&m.name!=="aria-label"&&m.value&&(c[m.name]=m.value);Object.keys(c).length>0&&(i.aria=c);let l=n.find(m=>m.kind==="title"),d=n.find(m=>m.kind==="desc");if(l?.text&&(i.title=l.text),d?.text&&(i.description=d.text),d){let m=e.index.element(d.sourceNodeId);m&&fk(m)&&(i.rawDescription=Lg(m,e))}let u=r.map(m=>cc(e,m)).join(`
|
|
39
39
|
`);u&&(i.rawMetadata=u,i.rawMetadataAuthoritative=!0);let f=Object.freeze(t.children.filter(m=>m.kind==="element"&&m.namespaceUri===$g&&["base","link","meta"].includes(m.localName.toLowerCase())).map(m=>Object.freeze({sourceNodeId:m.sourceNodeId,localName:m.localName.toLowerCase(),namespaceUri:$g,rawXml:cc(e,m)})));f.length>0&&(i.rawHtmlMetadata=f.map(m=>m.rawXml).join(`
|
|
40
40
|
`));let p=[];for(let m=t.children.length-1;m>=0;m--){let g=t.children[m];if(g.kind==="comment"){p.unshift(g.value);continue}if(!(g.kind==="text"&&!g.value.trim()))break}if(p.length>0&&(i.trailingComments=p),i.keywords&&Object.freeze(i.keywords),i.customMetadata&&Object.freeze(i.customMetadata),i.aria&&Object.freeze(i.aria),i.trailingComments&&Object.freeze(i.trailingComments),i.descriptiveElements){for(let m of i.descriptiveElements)Object.freeze(m);Object.freeze(i.descriptiveElements)}return Object.freeze({sourceNodeId:t.sourceNodeId,metadata:Object.freeze(i),descriptiveElements:n,htmlMetadata:f})}function i_(e,t){let n=e.index.parent(t.sourceNodeId);if(!n)return Object.freeze([]);let r=n.children.findIndex(o=>o.kind==="element"&&o.sourceNodeId===t.sourceNodeId);if(r<0)return Object.freeze([]);let i=[];for(let o=r-1;o>=0;o--){let s=n.children[o];if(s.kind==="comment"){i.unshift(s.value);continue}if(!(s.kind==="text"&&s.value.trim().length===0))break}return Object.freeze(i)}function _g(e,t){let n=[],r=[];for(let a of e.index.elements){if(a===e.root||a.namespaceUri!==te)continue;let c=dk(e,a),l=e_(e,a,c,t,n),d=i_(e,a);Object.keys(l).length===0&&c.length===0&&d.length===0||r.push(Object.freeze({sourceNodeId:a.sourceNodeId,metadata:l,descriptiveElements:c,leadingComments:d}))}let i=Object.freeze(r),o=new Map(i.map(a=>[a.sourceNodeId,a]));return{value:Object.freeze({document:r_(e),candidates:i,candidate(a){return o.get(a)??null}}),diagnostics:Object.freeze(n)}}var o_="http://www.w3.org/1999/xhtml",pk="http://www.w3.org/2000/xmlns/",s_=new Set(["font-face","hatch","solidcolor"]),a_=new Set(["title","desc"]);function mk(e,t){return{name:e.name,localName:e.localName,prefix:e.prefix,namespaceUri:e.namespaceUri,value:t}}function Bg(e,t){if(e.kind==="doctype")return null;if(e.kind!=="element")return{kind:e.kind,value:e.value};let n=t.attributeRewrites.get(e.sourceNodeId),r=t.textRewrites.get(e.sourceNodeId);return{kind:"element",name:e.name,localName:e.localName,prefix:e.prefix,namespaceUri:e.namespaceUri,attributes:e.attributes.filter(o=>o.namespaceUri!==pk).map(o=>{let s=o.localName==="id"&&o.namespaceUri===null?t.identifiers?.liveIdForSourceNodeId(e.sourceNodeId):void 0;return mk(o,s??n?.get(o.name)??o.value)}),children:r===void 0?e.children.flatMap(o=>{let s=Bg(o,t);return s?[s]:[]}):[{kind:"text",value:r}]}}function Vg(e){let t=new Map,n=new Map;for(let r of e?.rewrites??[]){if(r.target==="text-content"){n.set(r.sourceNodeId,r.value);continue}if(!r.name)continue;let i=t.get(r.sourceNodeId);i||(i=new Map,t.set(r.sourceNodeId,i)),i.set(r.name,r.value)}return{identifiers:e,attributeRewrites:t,textRewrites:n}}function gk(e,t){let n=Vg(t),r=n.attributeRewrites.get(e.sourceNodeId);return Object.freeze(e.attributes.filter(i=>i.namespaceUri!==pk).map(i=>{let o=i.localName==="id"&&i.namespaceUri===null?n.identifiers?.liveIdForSourceNodeId(e.sourceNodeId):void 0;return mk(i,o??r?.get(i.name)??i.value)}))}function lc(e,t){let n=Vg(t);return Object.freeze(e.flatMap(r=>{let i=Bg(r,n);return i?[i]:[]}))}function c_(e){return e.namespaceUri!==null&&(e.namespaceUri!==te&&e.namespaceUri!==o_||e.namespaceUri===te&&s_.has(e.localName.toLowerCase()))}function l_(e,t){return e.kind!=="element"?!1:c_(e)?!0:t==="defs"&&e.namespaceUri===te&&a_.has(e.localName.toLowerCase())}function Gg(e,t){let n=[],r=Vg(t),i=1,o=(a,c,l)=>{let d=0,u=0;for(let f of a){if(f.kind!=="element")continue;let p=u++;if(!l_(f,c))continue;let m=d++,g=Bg(f,r);!g||g.kind!=="element"||n.push({id:`document-extension-${i++}`,placement:c,order:m,...c==="defs"?{definitionOrder:p,definitionContainerId:l}:{},element:g})}};o(e.root.children,"root");let s=0;for(let a of e.root.children)a.kind==="element"&&a.namespaceUri===te&&a.localName.toLowerCase()==="defs"&&o(a.children,"defs",`svg-definition-container-${++s}`);return Object.freeze(n.map(a=>Object.freeze(a)))}function So(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function In(e,t,n=""){if(!So(e))return;t.onShape?.(e,n);let r=e.state;if(!So(r))return;let i=r.children;if(Array.isArray(i)&&i.forEach((o,s)=>{In(o,t,`${n}.state.children[${s}]`)}),t.onState){let o=r.symbolOverrides;if(So(o))for(let[s,a]of Object.entries(o))So(a)&&t.onState(a,`${n}.state.symbolOverrides[${s}]`);t.onState(r,`${n}.state`)}}function tu(e,t,n){Array.isArray(e)&&e.forEach((r,i)=>In(r,t,`${n}[${i}]`))}function ht(e,t){So(e)&&(tu(e.shapes,t,"shapes"),Array.isArray(e.library)&&e.library.forEach((n,r)=>{if(So(n))if(n.kind==="symbol"){if(tu(n.shapes,t,`library[${r}].shapes`),So(n.variants))for(let[i,o]of Object.entries(n.variants))tu(o,t,`library[${r}].variants[${i}]`)}else n.kind==="marker"&&tu(n.shapes,t,`library[${r}].shapes`)}))}var hk=new Set(["cursive","emoji","fangsong","fantasy","math","monospace","sans-serif","serif","system-ui","ui-monospace","ui-rounded","ui-sans-serif","ui-serif"]),d_=new Set(["inherit","initial","unset","revert","revert-layer"]);function yk(e){return e.trim().replace(/^["']|["']$/g,"").trim()}function dc(e){return hk.has(yk(e).toLowerCase())}function jg(e){let t=yk(e).toLowerCase();return t.length===0?!0:hk.has(t)||d_.has(t)}function nu(e){let t=[],n="",r=null;for(let o=0;o<e.length;o++){let s=e[o];if(r){s==="\\"&&o+1<e.length?n+=e[++o]:s===r?r=null:n+=s;continue}if(s==='"'||s==="'"){r=s;continue}if(s===","){let a=n.trim();a&&t.push(a),n="";continue}n+=s}let i=n.trim();return i&&t.push(i),t}function u_(e){let t=e.split(/[ ]+/);return t.length===0?!1:t.every(n=>/^-?[A-Za-z_\u0080-\uFFFF][A-Za-z0-9_\u0080-\uFFFF-]*$/.test(n))}function GY(e){let t=nu(e);return t.length===0?e:t.map(n=>dc(n)||u_(n)?n:`"${n.replace(/"/g,'\\"')}"`).join(", ")}function Sk(e){let t=nu(e);return t.length===0?!0:t.every(jg)}var ru=400;function Ug(e,t=ru){if(e===void 0)return t;let n=e.trim().toLowerCase();if(n===""||n==="normal")return 400;if(n==="bold")return 700;if(n==="bolder")return t<100||t<350?400:t<550?700:t<900?900:t;if(n==="lighter")return t<100?t:t<550?100:t<750?400:700;let r=Number.parseFloat(n);return Number.isFinite(r)?Math.min(1e3,Math.max(1,r)):t}function Hg(e){if(e===void 0)return"normal";let t=e.trim().toLowerCase();return t==="italic"||t.startsWith("oblique")?"italic":"normal"}function f_(e){return`${e.family}\0${e.weight}\0${e.style}`}function bk(e){let t=new Set,n=[];for(let r of e){let i=f_(r);t.has(i)||(t.add(i),n.push(r))}return n}var p_="https://boxy-svg.com";function vk(e){return/[\t\n\f\r ]/u.test(e??"")}function ou(e,t){if(e[t]!=="/"||e[t+1]!=="*")return t;let n=e.indexOf("*/",t+2);return n<0?e.length:n+2}function m_(e,t){let n=1,r=null,i=!1;for(let o=t+1;o<e.length;o++){let s=e[o];if(r){i?i=!1:s==="\\"?i=!0:s===r&&(r=null);continue}if(s==="/"&&e[o+1]==="*"){o=Math.max(o,ou(e,o)-1);continue}if(s==='"'||s==="'"){r=s;continue}if(s==="{")n++;else if(s==="}"&&--n===0)return o}return e.length-1}function su(e){let t=[],n=null,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(n){r?r=!1:o==="\\"?r=!0:o===n&&(n=null);continue}if(o==="/"&&e[i+1]==="*"){i=Math.max(i,ou(e,i)-1);continue}if(o==='"'||o==="'"){n=o;continue}if(o!=="@")continue;let s=i,a=i+1;for(;/[-_a-z0-9]/iu.test(e[a]??"");)a++;let c=e.slice(i+1,a).toLowerCase(),l=a,d=null,u=!1,f=0;for(;l<e.length;l++){let m=e[l];if(d){u?u=!1:m==="\\"?u=!0:m===d&&(d=null);continue}if(m==="/"&&e[l+1]==="*"){l=Math.max(l,ou(e,l)-1);continue}if(m==='"'||m==="'"){d=m;continue}if(m==="(")f++;else if(m===")")f=Math.max(0,f-1);else if(f===0&&(m===";"||m==="{"))break}if(l>=e.length)continue;if(e[l]===";"){t.push(Object.freeze({name:c,start:s,end:l+1,preludeStart:a,preludeEnd:l,blockStart:null,blockEnd:null})),i=l;continue}let p=m_(e,l);t.push(Object.freeze({name:c,start:s,end:Math.min(e.length,p+1),preludeStart:a,preludeEnd:l,blockStart:l+1,blockEnd:p}))}return Object.freeze(t)}function au(e){let t=e.trim();if(t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))){let n=t.slice(1,-1);return wa(n)??n}return wa(t)??t}function cu(e){let t=$r(e).find(r=>r.name==="url");if(t)return au(e.slice(t.argumentsStart,t.argumentsEnd));let n=e.trim();if(n.startsWith('"')||n.startsWith("'")){let r=n[0],i=n.indexOf(r,1);return i>0?n.slice(1,i):null}return null}function Yg(e,t=0){let n=[];for(let r of $r(e)){if(r.name==="url"){n.push(Object.freeze({rawUrl:au(e.slice(r.argumentsStart,r.argumentsEnd)),tokenStart:t+r.tokenStart,tokenEnd:t+r.tokenEnd}));continue}n.push(...Yg(e.slice(r.argumentsStart,r.argumentsEnd),t+r.argumentsStart))}return Object.freeze(n)}function g_(e){let t=su(e),n=t.filter(o=>o.name==="font-face"||o.name==="import"),r=[],i=0;for(let o of t){if(o.name!=="import")continue;let s=cu(e.slice(o.preludeStart,o.preludeEnd));s!==null&&r.push(Object.freeze({url:s,channel:"css-import",tokenIndex:i})),i++}for(let o of Yg(e))n.some(s=>o.tokenStart>=s.start&&o.tokenEnd<=s.end)||(r.push(Object.freeze({url:o.rawUrl,channel:"css-url",tokenIndex:i})),i++);return Object.freeze(r)}function bo(e){let t=e.trim();if(!t)return Object.freeze({status:"empty",requestUrl:null});if(/^data:/iu.test(t))return Object.freeze({status:"data",requestUrl:null});let n=lu(t);return Object.freeze(n?{status:"external",requestUrl:n.href}:{status:"blocked",requestUrl:null})}function Ik(e){return bo(e).status==="data"?e:""}var h_=new Set(["feimage","iframe","image","link","mpath","script","textpath","use"]),y_=new Set(["audio","embed","iframe","img","input","script","source","track","video"]);function qg(e){return e.replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">")}function wk(e){return qg(e).replace(/"/gu,""")}function Kg(e){return e.trim().startsWith("#")?e:Ik(e)}function kk(e,t){if(e.kind!=="element"){if(e.kind==="comment")return`<!--${e.value}-->`;if(e.kind==="processing-instruction"||e.kind==="doctype")return"";let a=t==="style"?iu(e.value):e.value;return qg(a)}let n=e.localName.toLowerCase();if(n==="script"||n==="meta"&&e.attributes.some(a=>a.localName.toLowerCase()==="http-equiv"&&a.value.trim().toLowerCase()==="refresh"))return"";let i=[];for(let a of e.attributes){let c=a.name.toLowerCase(),l=a.localName.toLowerCase();if(/^on/iu.test(c))continue;let d=a.value;l==="style"?d=iu(d):(c==="href"||c==="xlink:href")&&h_.has(n)||l==="src"&&y_.has(n)||l==="poster"&&n==="video"||l==="data"&&n==="object"?d=Kg(d):l==="srcset"?d="":a.namespaceUri===null&&!c.startsWith("xmlns")&&(d=iu(d)),i.push(`${a.name}="${wk(d)}"`)}let o=i.length>0?`<${e.name} ${i.join(" ")}>`:`<${e.name}>`,s=e.children.map(a=>kk(a,n)).join("");return`${o}${s}</${e.name}>`}function S_(e){let t=Cn(e,{source:"svg",entrypoint:"svg-document-import"});if(!t.value)return"";let n=kk(t.value.root,null);return e.trimStart().startsWith("<?xml")?`<?xml version="1.0" encoding="UTF-8"?>
|
|
41
|
-
${n}`:n}var b_=new Set(["animate","animatemotion","animatetransform","desc","metadata","mpath","set","title"]);function v_(e){switch(e.kind){case"text":return qg(e.value);case"comment":return`<!--${e.value}-->`;case"cdata":return`<![CDATA[${e.value.replaceAll("]]>","]]]]><![CDATA[>")}]]>`;case"processing-instruction":return`<?${e.value}?>`;case"doctype":return`<!DOCTYPE ${e.value}>`}}function Pk(e,t,n){let r=e.sourceNodeId===t,i=new Map(e.attributes.map(u=>[u.name,u.value])),o=e.attributes.map(u=>u.name),s=(u,f)=>{if(f===null){i.delete(u);return}i.has(u)||o.push(u),i.set(u,f)};r&&Object.prototype.hasOwnProperty.call(n,"clipPathUnits")&&s("clipPathUnits",n.clipPathUnits??null),n.clipRule!==void 0&&(r||!b_.has(e.localName.toLowerCase()))&&s("clip-rule",n.clipRule);let a=o.filter((u,f)=>o.indexOf(u)===f&&i.has(u)).map(u=>`${u}="${wk(i.get(u))}"`),c=`<${e.name}${a.length>0?` ${a.join(" ")}`:""}`,l=e.children.map(u=>u.kind==="element"?Pk(u,t,n):v_(u)).join(""),d=/\/\s*>\s*$/u.test(e.rawXml??"");return l.length===0&&d?`${c}/>`:`${c}>${l}</${e.name}>`}function x_(e,t){let n=Cn(`<svg xmlns="${te}">${e}</svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"});if(!n.value)return null;let r=n.value.index.children(n.value.root.sourceNodeId)[0];if(!r)return null;let i=r.localName.toLowerCase();return i!=="clippath"&&i!=="mask"?null:Pk(r,r.sourceNodeId,t)}function lu(e){let t=/^(https?):\/\/([^/?#\s\\]+)([^\s\\]*)$/iu.exec(e);if(!t)return null;let n=t[1].toLowerCase(),r=t[2],i=r.lastIndexOf("@"),o=i>=0?r.slice(0,i+1):"",s=r.slice(i+1);if(!s)return null;let a=s.startsWith("[")?s.slice(0,Math.max(0,s.indexOf("]")+1)).toLowerCase():s.split(":")[0].toLowerCase();if(!a)return null;let c=t[3]||"/",l=c.indexOf("?"),d=c.indexOf("#",Math.max(0,l)),u=l<0?"":c.slice(l+1,d<0?void 0:d);return Object.freeze({href:`${n}://${o}${s.toLowerCase()}${c}`,hostname:a,query:u})}function xk(e){try{return decodeURIComponent(e.replace(/\+/gu," "))}catch{return e.replace(/\+/gu," ")}}function Zg(e){let t=[],n=0,r=null,i=!1,o=0;for(let s=0;s<e.length;s++){let a=e[s];if(r){i?i=!1:a==="\\"?i=!0:a===r&&(r=null);continue}if(a==="/"&&e[s+1]==="*"){s=Math.max(s,ou(e,s)-1);continue}a==='"'||a==="'"?r=a:a==="("||a==="["?o++:a===")"||a==="]"?o=Math.max(0,o-1):a===","&&o===0&&(t.push(e.slice(n,s).trim()),n=s+1)}return t.push(e.slice(n).trim()),Object.freeze(t.filter(Boolean))}function Tk(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&(vk(e[n])||e[n]===",");)n++;if(n>=e.length)break;let r=n;for(;n<e.length&&!vk(e[n]);)n++;let i=e.slice(r,n);if(i.endsWith(",")){i=i.replace(/,+$/u,""),i&&t.push(i);continue}i&&t.push(i);let o=0;for(;n<e.length;){let s=e[n++];if(s==="(")o++;else if(s===")")o=Math.max(0,o-1);else if(s===","&&o===0)break}}return Object.freeze(t)}function Qg(e){if(typeof e!="string")return null;let t=au(Zg(e)[0]??"").trim();return!t||dc(t)?null:t}function I_(e){let t=[];for(let n of ri(e,";")){let r=e.slice(n.start,n.end),i=ri(r,":",!0)[0]?.end??r.length;if(i>=r.length)continue;let o=r.slice(0,i).trim().toLowerCase(),s=r.slice(i+1).trim();o&&t.push(Object.freeze({property:o,value:s}))}return Object.freeze(t)}function w_(e){let t=$r(e).find(n=>n.name==="format");return t&&au(e.slice(t.argumentsStart,t.argumentsEnd))||null}var k_=Object.freeze({"font-style":"style","font-weight":"weight","font-stretch":"stretch","font-display":"display","unicode-range":"unicodeRange","font-feature-settings":"featureSettings","font-variation-settings":"variationSettings","ascent-override":"ascentOverride","descent-override":"descentOverride","line-gap-override":"lineGapOverride","size-adjust":"sizeAdjust"});function P_(e){let t={};for(let n of e){let r=k_[n.property];r&&n.value&&(t[r]=n.value)}return Object.keys(t).length>0?Object.freeze(t):void 0}function Jg(e){let t=[];for(let n of su(e)){if(n.name!=="font-face"||n.blockStart===null||n.blockEnd===null)continue;let r=I_(e.slice(n.blockStart,n.blockEnd)),i=Qg(r.find(a=>a.property==="font-family")?.value),o=r.find(a=>a.property==="src")?.value;if(!i||!o)continue;let s=P_(r);for(let a of Zg(o)){let c=cu(a);if(c===null)continue;let l=bo(c);l.status!=="external"||!l.requestUrl||t.push(Object.freeze({family:i,url:l.requestUrl,format:w_(a),...s?{descriptors:s}:{}}))}}return Object.freeze(t)}function Rk(e){let t=[];for(let n of su(e)){if(n.name!=="import")continue;let r=cu(e.slice(n.preludeStart,n.preludeEnd));if(r===null)continue;let i=bo(r);if(i.status!=="external"||!i.requestUrl)continue;let o=lu(i.requestUrl);if(!o||o.hostname!=="fonts.googleapis.com")continue;let s=o.query.split("&").map(a=>a.split("=",2)).filter(([a])=>xk(a).toLowerCase()==="family").map(([,a])=>xk(a??""));for(let a of s)for(let c of a.split("|")){let l=c.split(":")[0].trim();l&&!dc(l)&&t.push(l)}}return Object.freeze(t)}function T_(e){return ri(e,";").map(t=>{let n=e.slice(t.start,t.end),r=ri(n,":",!0)[0]?.end??n.length;if(r>=n.length||n.slice(0,r).trim().toLowerCase()!=="src")return n;let o=n.slice(0,r+1),s=Zg(n.slice(r+1)).filter(a=>{let c=cu(a);return c===null||bo(c).status==="data"});return`${o} ${s.length>0?s.join(", "):'local("__svgsketch_quarantined_font__")'}`}).join(";")}function iu(e){let t=[];for(let i of su(e)){if(i.name==="import"){t.push({start:i.start,end:i.end,value:"/* external stylesheet import quarantined */"});continue}i.name!=="font-face"||i.blockStart===null||i.blockEnd===null||t.push({start:i.blockStart,end:i.blockEnd,value:T_(e.slice(i.blockStart,i.blockEnd))})}let n=e;for(let i of t.sort((o,s)=>s.start-o.start))n=`${n.slice(0,i.start)}${i.value}${n.slice(i.end)}`;let r=Yg(n).filter(i=>{let o=i.rawUrl.trim();return!o||o.startsWith("#")?!1:bo(o).status!=="data"}).sort((i,o)=>o.tokenStart-i.tokenStart);for(let i of r)n=`${n.slice(0,i.tokenStart)}url("data:application/octet-stream;base64,")${n.slice(i.tokenEnd)}`;return n}function R_(e,t,n){let r=[];for(let i of t.stylesheets)if(i.applicable){for(let o of Rk(i.authoredText))r.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"google-font-import",family:o}));for(let o of Jg(i.authoredText))r.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"external-font-face",family:o.family,url:o.url,format:o.format,...o.descriptors?{descriptors:o.descriptors}:{}}))}for(let i of e.index.elements)for(let o of i.attributes)if(!(o.namespaceUri!==p_||o.localName!=="fonts"))for(let s of o.value.split(",")){let a=s.replace(/\+/gu," ").trim();!a||a.includes("/")||dc(a)||r.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"boxy-fonts",family:a}))}for(let i of n.candidates){if(i.canonicalType!=="text"||i.status!=="materialized")continue;let o=a=>{let c=Qg(a);c&&r.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:i.occurrenceId,origin:"text-font-family",family:c}))};o(i.state.fontFamily);let s=Oi(i.state);if(s){o(s.baseStyle.fontFamily);for(let a of s.runs)o(a.style.fontFamily)}}return Object.freeze(r)}function Bn(e,t){return e.attributes.find(n=>n.namespaceUri===null&&n.localName.toLowerCase()===t.toLowerCase())?.value??null}function Wg(e){return e.children.map(t=>t.kind==="text"||t.kind==="cdata"?t.value:"").join("")}function eh(e,t){let n=[],r=[...e.index.children(t)].reverse();for(;r.length>0;){let i=r.pop();n.push(i),r.push(...[...e.index.children(i.sourceNodeId)].reverse())}return Object.freeze(n)}function Vn(e,t){let n=bo(t.href);e.push(Object.freeze({...t,...n}))}function _i(e,t,n,r=new Set(["css-import","css-url"]),i=()=>!0){for(let o of g_(t))!r.has(o.channel)||!i(o)||o.url.trim().startsWith("#")||Vn(e,{...n,occurrenceId:`${n.occurrenceId}:css:${o.tokenIndex}`,channel:o.channel,href:o.url,hrefNamespace:null})}function Ck(e,t,n,r){for(let i of eh(t,n.sourceNodeId)){let o=i.localName.toLowerCase(),s=Bn(i,"id"),a={sourceNodeId:i.sourceNodeId,occurrenceId:`${r}:foreign:${i.sourceNodeId}`,sourceId:s,elementName:i.localName},c=[{attributeName:"src",channel:"html-src",applies:["img","video","audio","source","track","iframe","embed"].includes(o)||o==="input"&&Bn(i,"type")?.toLowerCase()==="image"},{attributeName:"poster",channel:"html-poster",applies:o==="video"},{attributeName:"data",channel:"html-data",applies:o==="object"},{attributeName:"href",channel:"html-src",applies:o==="link"&&(Bn(i,"rel")??"").split(/\s+/u).some(u=>u.toLowerCase()==="stylesheet")}];for(let u of c){if(!u.applies)continue;let f=Bn(i,u.attributeName);f!==null&&Vn(e,{...a,occurrenceId:`${a.occurrenceId}:${u.attributeName}`,attributeName:u.attributeName,channel:u.channel,href:f,hrefNamespace:null})}let l=Bn(i,"srcset");if(l!==null&&(o==="img"||o==="source"))for(let[u,f]of Tk(l).entries())Vn(e,{...a,occurrenceId:`${a.occurrenceId}:srcset:${u}`,attributeName:"srcset",channel:"html-srcset",href:f,hrefNamespace:null});let d=Bn(i,"style");d!==null&&_i(e,d,{...a,attributeName:"style"}),o==="style"&&_i(e,Wg(i),{...a,attributeName:"textContent"})}}function C_(e,t,n,r){let i=Bn(n,"data-shape-type")?.toLowerCase();if(i==="video"||i==="audio"){let o=eh(t,n.sourceNodeId).find(s=>s.localName.toLowerCase()===i);if(o){let s=Bn(o,"src")??"";if(Vn(e,{sourceNodeId:o.sourceNodeId,occurrenceId:`${r}:media:src`,sourceId:Bn(o,"id"),elementName:i,attributeName:"src",channel:"html-src",href:s,hrefNamespace:null}),i==="video"){let a=Bn(n,"data-poster")??Bn(o,"poster");a!==null&&Vn(e,{sourceNodeId:n.sourceNodeId,occurrenceId:`${r}:media:poster`,sourceId:Bn(n,"id"),elementName:"video",attributeName:"poster",channel:"html-poster",href:a,hrefNamespace:null})}}return}Ck(e,t,n,r)}function A_(e,t,n){let r=[];for(let i of t.occurrences){let o=e.index.element(i.correspondingSourceNodeId);if(!o||o.namespaceUri!==te)continue;let s=o.localName.toLowerCase();if(s==="image"||s==="feimage"){let a=at(o)??{value:"",namespace:"svg2"};Vn(r,{sourceNodeId:o.sourceNodeId,occurrenceId:i.occurrenceId,sourceId:E(o,"id"),elementName:s==="feimage"?"feImage":"image",attributeName:"href",channel:"svg-href",href:a.value,hrefNamespace:a.namespace})}else s==="foreignobject"&&C_(r,e,o,i.occurrenceId)}for(let i of n.stylesheets)i.applicable&&_i(r,i.authoredText,{sourceNodeId:i.sourceNodeId,occurrenceId:`style:${i.sourceNodeId}`,sourceId:i.id,elementName:"style",attributeName:"textContent"},new Set(["css-import"]),o=>lu(o.url)?.hostname!=="fonts.googleapis.com");for(let i of n.elements){let o=e.index.element(i.correspondingSourceNodeId);if(!(!o||o.namespaceUri!==te))for(let s of Object.values(i.cascadedValues))_i(r,s.value,{sourceNodeId:s.sourceNodeId,occurrenceId:`style:${i.occurrenceId}:${s.propertyName}`,sourceId:null,elementName:"style-declaration",attributeName:s.propertyName})}return Object.freeze(r)}function Ak(e,t,n){let r=[...new Set(e.filter(d=>d.origin==="google-font-import"||d.origin==="boxy-fonts").map(d=>d.family))].sort(),i=[],o=new Set;for(let d of e){if(d.origin!=="external-font-face"||!d.url)continue;let u=`${d.family}\0${d.url}\0${d.format??""}\0${JSON.stringify(d.descriptors??{})}`;o.has(u)||(o.add(u),i.push(Object.freeze({family:d.family,url:d.url,format:d.format??null,...d.descriptors?{descriptors:d.descriptors}:{}})))}i.sort((d,u)=>d.family.localeCompare(u.family)||d.url.localeCompare(u.url)||(d.format??"").localeCompare(u.format??""));let s=[...new Set([...r,...i.map(d=>d.family)])].sort(),a=[...new Set(t.filter(d=>d.status==="external"&&d.requestUrl).map(d=>d.requestUrl))].sort(),c=[];s.length>0&&c.push(Object.freeze({kind:"font-consent",families:s,googleFamilies:r,...i.length>0?{externalSources:i}:{}})),a.length>0&&c.push(Object.freeze({kind:"external-asset-resolution",urls:a})),Object.freeze(s),Object.freeze(r),Object.freeze(i),Object.freeze(a),Object.freeze(c);let l=Object.freeze({fontCandidates:e,assetCandidates:t,effects:c});return Object.freeze({value:l,diagnostics:n})}function th(e,t,n,r,i){return Ak(R_(e,n,r),A_(e,t,n),Object.freeze([]))}function N_(e){let t=e.state,n=t.extra;return typeof n=="object"&&n!==null&&!Array.isArray(n)?{...n,...t}:t}function nh(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rh(e,t,n){for(let r of Rk(t))e.push(Object.freeze({sourceNodeId:n,occurrenceId:null,origin:"google-font-import",family:r}));for(let r of Jg(t))e.push(Object.freeze({sourceNodeId:n,occurrenceId:null,origin:"external-font-face",family:r.family,url:r.url,format:r.format,...r.descriptors?{descriptors:r.descriptors}:{}}))}function Nk(e,t,n,r){rh(e,n,r),_i(t,n,{sourceNodeId:r,occurrenceId:r,sourceId:null,elementName:"style",attributeName:"textContent"},void 0,o=>lu(o.url)?.hostname!=="fonts.googleapis.com");let i=new Set(Jg(n).map(o=>o.url));for(let o=t.length-1;o>=0;o--){let s=t[o];s.sourceNodeId===r&&i.has(s.requestUrl??"")&&t.splice(o,1)}}function E_(e,t,n,r){let i=[],o=c=>{c.kind==="element"&&(i.push(c),c.children.forEach(o))};n.forEach(o);let s=(c,l)=>c.attributes.find(d=>d.namespaceUri===null&&d.localName.toLowerCase()===l)?.value??null,a=c=>c.children.flatMap(l=>l.kind==="text"||l.kind==="cdata"?[l.value]:[]).join("");for(let[c,l]of i.entries()){let d=l.localName.toLowerCase(),u=s(l,"id"),f={sourceNodeId:`${r}:foreign:${c}`,occurrenceId:`${r}:foreign:${c}`,sourceId:u,elementName:l.localName},p=[{attributeName:"src",channel:"html-src",applies:["img","video","audio","source","track","iframe","embed"].includes(d)||d==="input"&&s(l,"type")?.toLowerCase()==="image"},{attributeName:"poster",channel:"html-poster",applies:d==="video"},{attributeName:"data",channel:"html-data",applies:d==="object"},{attributeName:"href",channel:"html-src",applies:d==="link"&&(s(l,"rel")??"").split(/\s+/u).some(h=>h.toLowerCase()==="stylesheet")}];for(let h of p){if(!h.applies)continue;let y=s(l,h.attributeName);y!==null&&Vn(t,{...f,occurrenceId:`${f.occurrenceId}:${h.attributeName}`,attributeName:h.attributeName,channel:h.channel,href:y,hrefNamespace:null})}let m=s(l,"srcset");if(m!==null&&(d==="img"||d==="source"))for(let[h,y]of Tk(m).entries())Vn(t,{...f,occurrenceId:`${f.occurrenceId}:srcset:${h}`,attributeName:"srcset",channel:"html-srcset",href:y,hrefNamespace:null});let g=s(l,"style");if(g!==null&&_i(t,g,{...f,attributeName:"style"}),d==="style"){let h=a(l);rh(e,h,f.sourceNodeId),_i(t,h,{...f,attributeName:"textContent"})}}}function ih(e,t,n,r){_i(e,t,{sourceNodeId:n,occurrenceId:`${n}:${r}`,sourceId:null,elementName:"canonical-state",attributeName:r})}function uc(e,t,n){if(nh(t))for(let[r,i]of Object.entries(t))typeof i=="string"&&ih(e,i,n,r)}function oh(e,t,n,r,i,o){if(Array.isArray(n))for(let[s,a]of n.entries()){if(!nh(a))continue;let c=`${r}:filter:${s}`;a.type==="feImage"&&Vn(t,{sourceNodeId:r,occurrenceId:c,sourceId:null,elementName:"feImage",attributeName:"href",channel:"canonical-state",href:typeof a.href=="string"?a.href:typeof a.xlinkHref=="string"?a.xlinkHref:"",hrefNamespace:typeof a.href=="string"?"svg2":"xlink"}),a.type==="raw-svg"&&typeof a.svgContent=="string"&&fc(e,t,a.svgContent,`${c}:raw`,i,o),oh(e,t,a.primitives,`${c}:primitives`,i,o)}}function Xg(e,t,n,r,i,o){!nh(n)||typeof n.svgContent!="string"||fc(e,t,n.svgContent,r,i,o)}function O_(e,t,n,r,i,o){let s=N_(n),a=`snapshot:${r}:${n.id}`;if(n.type==="text"){let c=d=>{let u=Qg(d);u&&e.push(Object.freeze({sourceNodeId:a,occurrenceId:a,origin:"text-font-family",family:u}))};c(s.fontFamily);let l=Oi(s);if(l){c(l.baseStyle.fontFamily);for(let d of l.runs)c(d.style.fontFamily)}}n.type==="image"?Vn(t,{sourceNodeId:a,occurrenceId:a,sourceId:n.id,elementName:"image",attributeName:"href",channel:"canonical-state",href:typeof s.href=="string"?s.href:"",hrefNamespace:null}):n.type==="video"||n.type==="audio"?(Vn(t,{sourceNodeId:a,occurrenceId:`${a}:src`,sourceId:n.id,elementName:n.type,attributeName:"href",channel:"canonical-state",href:typeof s.href=="string"?s.href:"",hrefNamespace:null}),n.type==="video"&&typeof s.posterHref=="string"&&Vn(t,{sourceNodeId:a,occurrenceId:`${a}:poster`,sourceId:n.id,elementName:"video",attributeName:"posterHref",channel:"canonical-state",href:s.posterHref,hrefNamespace:null})):n.type==="foreign-object"&&Array.isArray(s.foreignContent)&&E_(e,t,s.foreignContent,a),Xg(e,t,s.fillGradient,`${a}:fillGradient`,i,o),Xg(e,t,s.strokeGradient,`${a}:strokeGradient`,i,o),oh(e,t,s.filters,a,i,o),uc(t,s.authoredAttributes,`${a}:authored`),uc(t,s.containerPresentation,`${a}:container-presentation`),uc(t,s.instancePresentation,`${a}:instance-presentation`),uc(t,s.cssMaskProperties,`${a}:mask`),typeof s.cssClipPath=="string"&&ih(t,s.cssClipPath,a,"clip-path")}function fc(e,t,n,r,i,o){let s=Cn(`<svg xmlns="${te}">${n}</svg>`,i);if(!s.value){o.push(...s.diagnostics.map(c=>Object.freeze({...c,severity:"warning",message:`Canonical raw definition could not be inspected for external requests: ${c.message}`,documentPath:r})));return}let a=new Set;for(let c of s.value.index.elements){if(c.localName.toLowerCase()!=="foreignobject")continue;let l=`${r}:${c.sourceNodeId}`;Ck(t,s.value,c,l);for(let d of eh(s.value,c.sourceNodeId))a.add(d.sourceNodeId),d.localName.toLowerCase()==="style"&&rh(e,Wg(d),`${r}:${d.sourceNodeId}`)}for(let c of s.value.index.elements){if(a.has(c.sourceNodeId))continue;let l=c.localName.toLowerCase();if(c.namespaceUri===te&&(l==="image"||l==="feimage")){let d=at(c)??{value:"",namespace:"svg2"};Vn(t,{sourceNodeId:`${r}:${c.sourceNodeId}`,occurrenceId:`${r}:${c.sourceNodeId}`,sourceId:Bn(c,"id"),elementName:l==="feimage"?"feImage":"image",attributeName:"href",channel:"canonical-state",href:d.value,hrefNamespace:d.namespace})}l==="style"&&Nk(e,t,Wg(c),`${r}:${c.sourceNodeId}:style`);for(let d of c.attributes)d.localName.toLowerCase()==="href"||d.localName.toLowerCase()==="src"||ih(t,d.value,`${r}:${c.sourceNodeId}`,d.name)}}function D_(e,t){let n=[],r=[],i=[];for(let[s,a]of(e.documentStyles??[]).entries())Nk(n,r,a.css,`snapshot:documentStyles[${s}]`);ht(e,{onShape:(s,a)=>O_(n,r,s,a,t,i)});for(let[s,a]of(e.library??[]).entries()){let c=`snapshot:library[${s}]`;a.kind==="pattern"?Xg(n,r,a.pattern,`${c}:pattern`,t,i):a.kind==="filter"?oh(n,r,a.filters,`${c}:filters`,t,i):(a.kind==="symbol"||a.kind==="marker")&&uc(r,a.rootAttributes,`${c}:root`)}let o=e.documentMetadata?.rawHtmlMetadata;typeof o=="string"&&fc(n,r,o,"snapshot:documentMetadata.rawHtmlMetadata",t,i);for(let[s,a]of(e.paintServerDefs??[]).entries())fc(n,r,a.markup,`snapshot:paintServerDefs[${s}]`,t,i);for(let[s,a]of(e.clipMaskGroups??[]).entries())a.rawDefinition&&fc(n,r,a.rawDefinition,`snapshot:clipMaskGroups[${s}].rawDefinition`,t,i);return Ak(Object.freeze(n),Object.freeze(r),Object.freeze(i))}function $_(e,t,n){let r=new Set,i=o=>{let s=o;for(;s;){let a=s.localName.toLowerCase();if(a==="clippath"||a==="mask")return!0;s=e.index.parent(s.sourceNodeId)}return!1};for(let o of n.css){let s=t.occurrence(o.occurrenceId);if(!s)continue;let a=e.index.element(s.correspondingSourceNodeId);a&&i(a)&&r.add(a.sourceNodeId)}return e.index.elements.filter(o=>r.has(o.sourceNodeId)).map(o=>o.sourceNodeId)}var Ek=Object.freeze({matchesMedia(e){let t=e.trim().toLowerCase();return t===""||t==="all"||t==="screen"},supportsCondition(){return!1}}),M_=new Map([["clippath","clip-path"],["marker","marker"],["mask","mask"],["pattern","pattern"]]);function z_(e){return Object.freeze(e.index.elements.flatMap(t=>{let n=M_.get(t.localName.toLowerCase());return n?[Object.freeze({sourceNodeId:t.sourceNodeId,capability:n})]:[]}))}function F_(e,t,n){let r=new Map(e.occurrences.map(i=>[i.occurrenceId,i]));return Object.freeze([...t.candidates.filter(i=>i.status==="materialized").map(i=>i.occurrenceId),...n.uses.filter(i=>["symbol-instance","linked-reference"].includes(i.status)).map(i=>i.useOccurrenceId)].filter(i=>r.get(i)?.role!=="definition"))}function du(e,t={}){let n={source:t.source??"svg",entrypoint:t.entrypoint??"svg-document-import"},r=Cn(e,n,t.xmlHost);if(!r.value)return Object.freeze({value:null,diagnostics:r.diagnostics});let i=r.value,o=om(i.root,n),s=Object.freeze({width:o.value.viewBoxWidth??300,height:o.value.viewBoxHeight??150}),a=t.rootFontSize??16,c=Object.freeze({viewport:Object.freeze({x:o.value.viewBoxX??0,y:o.value.viewBoxY??0,...s}),rootFontSize:a}),l=gm(i,n),d=l.value.condition(i.root.sourceNodeId),u=yg(i,n),f=_g(i,n),p=bm(i,{...n,resourceRoots:z_(i),...t.maxUseDepth!==void 0?{maxDepth:t.maxUseDepth}:{},...t.maxUseOccurrences!==void 0?{maxOccurrences:t.maxUseOccurrences}:{}}),m=Om(i,p,{...n,environment:t.styleEnvironment??Ek}),g=qa(i,p,m.value,{viewport:s,rootFontSize:a}),h=Qm(i,p,m.value,{...n,viewport:s,rootFontSize:a,viewportPlan:g,...t.textMetricsHost?{textMetricsHost:t.textMetricsHost}:{}}),y=$m(i,p,m.value,{...n,leafGeometry:h.value}),S=ym(i,{...t.claimedIds?{claimedIds:t.claimedIds}:{},cssAnimationTargetSourceNodeIds:$_(i,p,y.value)}),b=S.liveIdForSourceNodeId(i.root.sourceNodeId),I=Object.freeze({...o.value,...b?{svgId:b}:{},...d?.systemLanguage!==null&&d?.systemLanguage!==void 0?{systemLanguage:d.systemLanguage}:{},...d?.requiredExtensions!==null&&d?.requiredExtensions!==void 0?{requiredExtensions:d.requiredExtensions}:{}}),v=Gg(i,S),w=wm(i,{...n,appliedDeclarations:m.value.appliedResourceDeclarations}),k=og(i,p,m.value,w,h.value,{...n,viewport:s,rootFontSize:a}),C=new Set;for(let H of k.value.definitions)if(H.representation==="decomposed")for(let ie of H.geometrySourceNodeIds)C.add(ie);for(let H of y.value.smil)H.motionPathSourceNodeId&&C.add(H.motionPathSourceNodeId);let P=vm(i,p,m.value,{...n,nativeDefinitionSourceNodeIds:C,privateGeometrySourceNodeIds:new Set(h.value.privateTextPathGeometry.map(H=>H.pathSourceNodeId))}),R=pg(i,p,m.value,w,{...n,viewport:s,rootFontSize:a}),N=sg(i,p,m.value,w,{...n,viewport:s,rootFontSize:a}),M=cg(i,p,m.value,w,{...n,viewport:s,rootFontSize:a}),A=lg(i,p,m.value,w,{...n,viewport:s,rootFontSize:a}),$=fg(i,S,n),_=am(i,n),z=cm(i,p,g,n),j=km(i),G=th(i,p,m.value,h.value,n),W=dm(i,p,{...n,materializedOccurrenceIds:F_(p,h.value,P)}),V=[...r.diagnostics,...o.diagnostics,...l.diagnostics,...u.diagnostics,...f.diagnostics,...p.diagnostics,...m.diagnostics,...y.diagnostics,...P.diagnostics,...h.diagnostics,...w.diagnostics,...k.diagnostics,...R.diagnostics,...N.diagnostics,...M.diagnostics,...A.diagnostics,...$.diagnostics,..._.diagnostics,...z.diagnostics,...G.diagnostics,...W.diagnostics],X=Object.freeze({projectionContext:c,sourceDocument:i,rootFrame:I,identifiers:S,conditionalProcessing:l.value,scripts:u.value,metadata:f.value,documentExtensions:v,useOccurrences:p,styles:m.value,viewportContexts:g,animations:y.value,symbolUses:P,leafGeometry:h.value,resourceDependencies:w,clipMasks:k.value,filters:R.value,markers:N.value,gradients:M.value,patterns:A.value,paintServerDefinitions:$.value,views:_.value,embeddedFrames:z.value,authoredAttributes:j,externalEffects:G.value,hierarchy:W.value});return Object.freeze({value:X,diagnostics:Object.freeze(V)})}function me(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`id-${crypto.randomUUID()}`:`id-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function pc(e={}){let t={schemaVersion:Tn,shapes:e.shapes?e.shapes.map(n=>({...n})):[],viewboxes:e.viewboxes?e.viewboxes.map(n=>({...n})):[]};return e.metadata&&(t.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{},...e.metadata}),t}function L_(e){let{type:t,id:n,...r}=e,i={};for(let[o,s]of Object.entries(r))s!==void 0&&(i[o]=s);return{id:n??me(),type:t,state:i}}function ks(e,t,n,r,i){return{id:i??me(),x:e,y:t,width:n,height:r}}var uu=class{schemas=new Map;register(t,n){this.schemas.set(t,n)}get(t){return this.schemas.get(t)}typeIds(){return[...this.schemas.keys()]}getDefaults(t){let n=this.schemas.get(t);if(!n)return{};let r={};for(let i of Object.keys(n))r[i]=n[i].default;return r}validate(t,n,r){let i=this.schemas.get(t);if(!i)return r;let o=i[n];return o?.validate?o.validate(r):r}},Ee=e=>Math.max(0,e),Ps=e=>Math.max(0,Math.min(1,e)),zt=e=>Math.max(0,Math.min(100,e)),__=e=>Math.max(1,e),B_=e=>Math.max(3,Math.min(100,Math.floor(e))),V_=e=>Math.max(3,Math.min(50,Math.floor(e))),G_=e=>Math.max(3,Math.min(30,Math.floor(e))),j_=e=>Math.max(1,Math.min(10,e)),U_=e=>!e||typeof e!="object"||Array.isArray(e)||e.kind!=="shape"&&e.kind!=="definition"||typeof e.targetId!="string"||e.targetId.length===0||e.element!=="href"&&e.element!=="mpath"?null:{kind:e.kind,targetId:e.targetId,element:e.element};function H_(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{default:n}]))}var K_=H_(Hb),kt={layerName:{default:null},fillColor:{default:"#ffffff"},borderColor:{default:"#000000"},borderWidth:{default:1},opacity:{default:1,validate:Ps},fillOpacity:{default:1,validate:Ps},strokeOpacity:{default:1,validate:Ps},...K_,locked:{default:!1},visible:{default:!0},fillType:{default:"solid"},fillGradient:{default:null},strokeType:{default:"solid"},strokeGradient:{default:null},fillRule:{default:"nonzero"},strokeLinejoin:{default:"miter"},strokeLinecap:{default:"butt"},strokeMiterlimit:{default:4,validate:__},lineStyle:{default:"solid"},dashLength:{default:8},gapLength:{default:4},dashOffset:{default:0},strokeDasharray:{default:null},colorInterpolation:{default:null},filters:{default:[]},filterColorInterpolation:{default:null},filterUnits:{default:null},primitiveUnits:{default:null},filterX:{default:null},filterY:{default:null},filterWidth:{default:null},filterHeight:{default:null},metadata:{default:null},cssClipPath:{default:null},cssMaskProperties:{default:null}},nr={...kt,cx:{default:0},cy:{default:0},radius:{default:50,validate:Ee},cornerRadius:{default:0,validate:Ee},shiftAngle:{default:0}},Ts={...kt,x:{default:0},y:{default:0},width:{default:100,validate:Ee},height:{default:60,validate:Ee}},Ok={...kt,x:{default:0},y:{default:0},width:{default:0,validate:Ee},height:{default:0,validate:Ee},href:{default:""},mediaMimeType:{default:""},originalWidth:{default:0},originalHeight:{default:0},naturalDuration:{default:0},preserveAspectRatio:{default:!0},begin:{default:0},trimStart:{default:0},volume:{default:1,validate:Ps},muted:{default:!1},loop:{default:!1},playbackRate:{default:1},mediaOpacity:{default:1,validate:Ps},fadeInDuration:{default:0,validate:Ee},fadeOutDuration:{default:0,validate:Ee},posterHref:{default:""},sourceRect:{default:null}},Te=new uu;Te.register("rectangle",{...kt,x:{default:0},y:{default:0},width:{default:100,validate:Ee},height:{default:100,validate:Ee},rx:{default:0,validate:Ee},ry:{default:0,validate:Ee},cornerRadius:{default:0,validate:Ee},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:Ee},cornerRadiusTR:{default:0,validate:Ee},cornerRadiusBL:{default:0,validate:Ee},cornerRadiusBR:{default:0,validate:Ee},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});Te.register("square",{...kt,x:{default:0},y:{default:0},size:{default:100,validate:Ee},width:{default:100,validate:Ee},height:{default:100,validate:Ee},rx:{default:0,validate:Ee},ry:{default:0,validate:Ee},cornerRadius:{default:0,validate:Ee},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:Ee},cornerRadiusTR:{default:0,validate:Ee},cornerRadiusBL:{default:0,validate:Ee},cornerRadiusBR:{default:0,validate:Ee},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});Te.register("circle",{...kt,x:{default:0},y:{default:0},radius:{default:50,validate:Ee}});Te.register("ellipse",{...kt,x:{default:0},y:{default:0},rx:{default:50,validate:Ee},ry:{default:30,validate:Ee}});Te.register("line",{...kt,fillType:{default:"none"},x1:{default:0},y1:{default:0},x2:{default:100},y2:{default:0},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});Te.register("text",{...kt,x:{default:0},y:{default:0},width:{default:0,validate:Ee},height:{default:0,validate:Ee},textX:{default:0},textY:{default:0},fontSize:{default:24},text:{default:""},fontFamily:{default:"Arial"},fontWeight:{default:"normal"},fontStyle:{default:"normal"},fontStretch:{default:"normal"},fontSizeAdjust:{default:"none"},fontVariant:{default:""},fontVariantLigatures:{default:""},fontVariantPosition:{default:""},fontVariantCaps:{default:""},fontVariantNumeric:{default:""},fontVariantEastAsian:{default:""},textDecoration:{default:{}},textTransform:{default:"none"},baselineShift:{default:"baseline"},dominantBaseline:{default:"auto"},alignmentBaseline:{default:"auto"},writingMode:{default:"horizontal-tb"},textAnchor:{default:"start"},letterSpacing:{default:0},wordSpacing:{default:0},lineHeight:{default:1.2},inlineSize:{default:0},overflowWrap:{default:"normal"},whiteSpace:{default:"pre-wrap"},textDirection:{default:"ltr"},unicodeBidi:{default:"normal"},scaleX:{default:1},scaleY:{default:1},scaleAnchor:{default:null},useRichText:{default:!1},richTextRuns:{default:null},charOffsets:{default:null},fontVariationSettings:{default:{}},isTextPath:{default:!1},textPathPoints:{default:null},textPathStartOffset:{default:0},textPathSide:{default:"left"},textPathReference:{default:null,validate:U_},shapeInsideRef:{default:null},shapePadding:{default:0}});Te.register("image",{...kt,x:{default:0},y:{default:0},width:{default:100,validate:Ee},height:{default:100,validate:Ee},href:{default:""},originalWidth:{default:0},originalHeight:{default:0},preserveAspectRatio:{default:!0},imageOpacity:{default:1,validate:Ps}});Te.register("path",{...kt,x:{default:0},y:{default:0},width:{default:0,validate:Ee},height:{default:0,validate:Ee},pathPoints:{default:[]},pathArcParams:{default:[]},pathControlBounds:{default:null},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});Te.register("polyline",{...kt,x:{default:0},y:{default:0},width:{default:0,validate:Ee},height:{default:0,validate:Ee},polylinePoints:{default:[]},polylineClosed:{default:!1}});Te.register("triangle",{...nr,sides:{default:3}});Te.register("ngon",{...nr,sides:{default:6,validate:B_}});Te.register("star",{...nr,arms:{default:5,validate:V_},innerRadiusPercent:{default:40,validate:zt}});Te.register("cross",{...nr,armWidthPercent:{default:30,validate:zt}});Te.register("ring",{...nr,innerRadiusPercent:{default:50,validate:zt}});Te.register("spiral",{...nr,turns:{default:3,validate:j_},thicknessPercent:{default:15,validate:zt},spiralDirection:{default:1}});Te.register("gear",{...nr,teeth:{default:8,validate:G_},toothDepthPercent:{default:25,validate:zt},holeRadiusPercent:{default:20,validate:zt}});Te.register("arrow",{...nr,headWidthPercent:{default:100,validate:zt},headLengthPercent:{default:40,validate:zt},shaftWidthPercent:{default:40,validate:zt}});Te.register("symbol-instance",{...kt,x:{default:0},y:{default:0},width:{default:100,validate:Ee},height:{default:100,validate:Ee},symbolId:{default:""}});Te.register("group",{...kt});Te.register("container",{...kt});Te.register("cloud",{...nr,cloudBumps:{default:5},cloudPuffinessPercent:{default:60,validate:zt}});Te.register("heart",{...nr,lobeRadiusPercent:{default:50,validate:zt},cleftDepthPercent:{default:25,validate:zt}});Te.register("lightning",{...nr,boltSegments:{default:3},boltWidthPercent:{default:30,validate:zt},boltJaggednessPercent:{default:40,validate:zt}});Te.register("speechBubble",{...nr,tailAngleDeg:{default:45},tailLengthPercent:{default:40,validate:zt},tailWidthPercent:{default:25,validate:zt}});Te.register("diamond",{...Ts});Te.register("parallelogram",{...Ts,slantPercent:{default:20,validate:zt}});Te.register("trapezoid",{...Ts,topWidthPercent:{default:70,validate:zt}});Te.register("terminator",{...Ts});Te.register("cylinder",{...Ts,capHeightPercent:{default:15,validate:zt}});Te.register("document-shape",{...Ts,waveAmplitudePercent:{default:15,validate:zt}});Te.register("hyperlink",{...kt,href:{default:""},hrefXlink:{default:""},linkTarget:{default:""},linkPing:{default:""},linkRel:{default:""},linkHreflang:{default:""},linkType:{default:""},linkReferrerPolicy:{default:""}});Te.register("switch",{...kt,switchSystemLanguage:{default:null},switchRequiredExtensions:{default:null}});Te.register("svg",{...kt});Te.register("view",{...kt,viewBoxX:{default:0},viewBoxY:{default:0},viewBoxWidth:{default:0,validate:Ee},viewBoxHeight:{default:0,validate:Ee},viewName:{default:""},viewPreserveAspectRatio:{default:""},viewTarget:{default:""}});Te.register("shape-reference",{...kt,targetShapeId:{default:""},offsetX:{default:0},offsetY:{default:0},targetWidth:{default:0,validate:Ee},targetHeight:{default:0,validate:Ee},broken:{default:!1}});Te.register("foreign-object",{...kt,x:{default:0},y:{default:0},width:{default:0,validate:Ee},height:{default:0,validate:Ee},foreignContent:{default:[]}});Te.register("video",{...Ok,mediaKind:{default:"video"}});Te.register("audio",{...Ok,mediaKind:{default:"audio"}});Te.register("document",{});function sh(e){let t=new Set;for(let n of e??[])In(n,{onShape:r=>{r.id&&t.add(r.id)}});return t}function br(e){let t=sh(e.shapes),n=new Map;for(let i of e.library??[]){let o=new Set([i.id]);if(i.kind==="symbol"||i.kind==="marker")for(let s of sh(i.shapes))o.add(s);if(i.kind==="symbol")for(let s of Object.values(i.variants??{}))for(let a of sh(s))o.add(a);for(let s of o){let a=n.get(s)??new Set;a.add(i.id),n.set(s,a)}}let r=new Map;for(let[i,o]of n)r.set(i,Object.freeze([...o].sort()));return{documentParentIds:t,definitionIdsByParentId:r,resolve(i){if(i.parentDefinitionId!==void 0)return(r.get(i.parentId)??[]).includes(i.parentDefinitionId)?{kind:"library",definitionId:i.parentDefinitionId}:{kind:"missing"};if(t.has(i.parentId))return{kind:"document"};let o=r.get(i.parentId)??[];return o.length===1?{kind:"library",definitionId:o[0]}:o.length>1?{kind:"ambiguous",definitionIds:o}:{kind:"missing"}}}}var W_;function X_(){return W_??=new Set([...Te.typeIds().filter(e=>e!=="document"),"spline"])}function vo(e){let t=[],n=[];if(e==null||typeof e!="object")return t.push({path:"",message:"Snapshot must be a non-null object",severity:"error"}),{valid:!1,errors:t,warnings:n};let r=e;for(let o of Object.keys(r))o in pn||n.push({path:o,message:`Unknown top-level field "${o}" (likely written by a newer version); it is preserved in the unknownFields quarantine on save`,severity:"warning"});let i={doc:r,errors:t,warnings:n};for(let o of Object.keys(pn)){let s=r[o];s===void 0&&!pn[o].required||o1[o](s,i)}return Z_(r,t),{valid:t.length===0,errors:t,warnings:n}}function de(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Y_(e){let t=new Map,n=r=>{if(Array.isArray(r)){for(let i of r)if(!(!de(i)||!de(i.state))){if(typeof i.id=="string"&&i.type==="text"){let o=new Map,s=i.state.textSpanTree,a=c=>{if(Array.isArray(c))for(let l of c)de(l)&&(typeof l.spanId=="string"&&l.spanId.length>0&&o.set(l.spanId,{start:l.start,end:l.end}),a(l.children))};de(s)&&a(s.spans),t.set(i.id,o)}n(i.state.children)}}};return n(e),t}function jt(e,t,n){return Array.isArray(e)?!0:(n.push({path:t,message:`${t} must be an array`,severity:"error"}),!1)}function Rs(e,t,n){e!==void 0&&(typeof e!="number"||!Number.isInteger(e)||e<0)&&n.push({path:t,message:"Definition order must be a non-negative integer",severity:"error"})}function Cs(e,t,n){e!==void 0&&(typeof e!="string"||e.length===0)&&n.push({path:t,message:"Definition container id must be a non-empty string",severity:"error"})}function q_(e,t,n,r){if(e===void 0||!jt(e,t,r))return;let i=new Set;e.forEach((o,s)=>{let a=`${t}[${s}]`;if(!de(o)){r.push({path:a,message:"Animation track must be an object",severity:"error"});return}if(typeof o.id!="string"||o.id.length===0?r.push({path:`${a}.id`,message:"Animation track id must be a non-empty string",severity:"error"}):i.has(o.id)?r.push({path:`${a}.id`,message:`Duplicate animation track id: "${o.id}"`,severity:"error"}):i.add(o.id),(typeof o.shapeId!="string"||!n.has(o.shapeId))&&r.push({path:`${a}.shapeId`,message:"Definition animation must target a shape owned by the definition",severity:"error"}),!Array.isArray(o.keyframes)){r.push({path:`${a}.keyframes`,message:"Animation track keyframes must be an array",severity:"error"});return}let c=new Set;o.keyframes.forEach((l,d)=>{let u=`${a}.keyframes[${d}].id`;!de(l)||typeof l.id!="string"||!l.id?r.push({path:u,message:"Animation keyframe id must be a non-empty string",severity:"error"}):c.has(l.id)?r.push({path:u,message:`Duplicate animation keyframe id: "${l.id}"`,severity:"error"}):c.add(l.id)})})}function Z_(e,t){let n=new Set(Array.isArray(e.definitionContainers)?e.definitionContainers.flatMap(s=>de(s)&&typeof s.id=="string"?[s.id]:[]):[]),r=(s,a)=>{!de(s)||s.definitionContainerId===void 0||typeof s.definitionContainerId!="string"||s.definitionContainerId.length===0||n.has(s.definitionContainerId)||t.push({path:`${a}.definitionContainerId`,message:`Definition container "${s.definitionContainerId}" does not exist`,severity:"error"})};for(let[s,a]of[["documentExtensions",e.documentExtensions],["documentStyles",e.documentStyles],["library",e.library],["paintServerDefs",e.paintServerDefs],["clipMaskGroups",e.clipMaskGroups]])Array.isArray(a)&&a.forEach((c,l)=>r(c,`${s}[${l}]`));de(e.animationTimeline)&&Array.isArray(e.animationTimeline.tracks)&&e.animationTimeline.tracks.forEach((s,a)=>{if(!de(s)||s.sourceSmilDefinitionContainerId===void 0)return;let c=s.sourceSmilDefinitionContainerId;typeof c!="string"||c.length===0||n.has(c)||t.push({path:`animationTimeline.tracks[${a}].sourceSmilDefinitionContainerId`,message:`Definition container "${c}" does not exist`,severity:"error"})});let i=new Set(Array.isArray(e.library)?e.library.flatMap(s=>de(s)&&typeof s.id=="string"?[s.id]:[]):[]);Array.isArray(e.documentStyles)&&e.documentStyles.forEach((s,a)=>{!de(s)||s.scopeDefinitionId===void 0||typeof s.scopeDefinitionId!="string"||s.scopeDefinitionId.length===0||i.has(s.scopeDefinitionId)||t.push({path:`documentStyles[${a}].scopeDefinitionId`,message:`Scoped definition "${s.scopeDefinitionId}" does not exist`,severity:"error"})});let o=(s,a)=>{Array.isArray(s)&&s.forEach((c,l)=>{let d=`${a}[${l}]`;!de(c)||!de(c.state)||(r(c.state,`${d}.state`),o(c.state.children,`${d}.state.children`))})};o(e.shapes,"shapes"),Array.isArray(e.library)&&e.library.forEach((s,a)=>{de(s)&&o(s.shapes,`library[${a}].shapes`)})}var Q_=new Set(["text","comment","cdata","processing-instruction"]);function Mk(e,t,n){if(!de(e)){n.push({path:t,message:"Document extension attribute must be a plain object",severity:"error"});return}for(let r of["name","localName","value"])typeof e[r]!="string"&&n.push({path:`${t}.${r}`,message:`${r} must be a string`,severity:"error"});for(let r of["prefix","namespaceUri"])e[r]!==null&&typeof e[r]!="string"&&n.push({path:`${t}.${r}`,message:`${r} must be a string or null`,severity:"error"})}function zk(e,t,n){let r=[{node:e,path:t,depth:0}];for(;r.length>0;){let i=r.pop();if(i.depth>64){n.push({path:i.path,message:"Document extension nesting exceeds 64 levels",severity:"error"});continue}if(!de(i.node)){n.push({path:i.path,message:"Document extension node must be a plain object",severity:"error"});continue}let o=i.node;if(o.kind==="element"){for(let s of["name","localName"])(typeof o[s]!="string"||o[s].length===0)&&n.push({path:`${i.path}.${s}`,message:`${s} must be a non-empty string`,severity:"error"});for(let s of["prefix","namespaceUri"])o[s]!==null&&typeof o[s]!="string"&&n.push({path:`${i.path}.${s}`,message:`${s} must be a string or null`,severity:"error"});jt(o.attributes,`${i.path}.attributes`,n)&&o.attributes.forEach((s,a)=>Mk(s,`${i.path}.attributes[${a}]`,n)),jt(o.children,`${i.path}.children`,n)&&o.children.forEach((s,a)=>r.push({node:s,path:`${i.path}.children[${a}]`,depth:i.depth+1}));continue}Q_.has(String(o.kind))||n.push({path:`${i.path}.kind`,message:"Unsupported document extension node kind",severity:"error"}),typeof o.value!="string"&&n.push({path:`${i.path}.value`,message:"Document extension character value must be a string",severity:"error"})}}function J_(e,t,n,r){if(!de(e)){n.push({path:t,message:"Document extension must be a plain object",severity:"error"});return}typeof e.id!="string"||e.id.length===0?n.push({path:`${t}.id`,message:"Document extension id must be a non-empty string",severity:"error"}):r.has(e.id)?n.push({path:`${t}.id`,message:`Duplicate document extension id: "${e.id}"`,severity:"error"}):r.add(e.id),e.placement!=="root"&&e.placement!=="defs"&&n.push({path:`${t}.placement`,message:"Document extension placement must be root or defs",severity:"error"}),(typeof e.order!="number"||!Number.isInteger(e.order)||e.order<0)&&n.push({path:`${t}.order`,message:"Document extension order must be a non-negative integer",severity:"error"}),Rs(e.definitionOrder,`${t}.definitionOrder`,n),Cs(e.definitionContainerId,`${t}.definitionContainerId`,n),zk(e.element,`${t}.element`,n)}var e1=new Set(["x1","y1","x2","y2","gradientTransform"]),t1=new Set(["cx","cy","fx","fy","r","fr","gradientTransform"]),n1=new Set(["x","y","width","height"]);function wn(e,t,n){e.push({path:t,message:n,severity:"error"})}function r1(e,t,n,r){if(!de(e)){wn(r,t,"Gradient must be a plain object");return}if(e.templateId!==void 0&&typeof e.templateId!="string"&&wn(r,`${t}.templateId`,"templateId must be a string"),e.rootAttributes!==void 0)if(!de(e.rootAttributes))wn(r,`${t}.rootAttributes`,"Gradient rootAttributes must be a plain object");else for(let[o,s]of Object.entries(e.rootAttributes))Mi(o)||wn(r,`${t}.rootAttributes.${o}`,"Gradient root attributes must be safe non-typed attributes"),typeof s!="string"&&wn(r,`${t}.rootAttributes.${o}`,"Gradient root attribute values must be strings");let i=n==="linear-gradient"?["x1","y1","x2","y2","opacity"]:["cx","cy","fx","fy","r","ry","rotation","opacity"];for(let o of i)e[o]!==void 0&&(typeof e[o]!="number"||!Number.isFinite(e[o]))&&wn(r,`${t}.${o}`,`${o} must be a finite number`);if(e.fr!==void 0&&(typeof e.fr!="number"||!Number.isFinite(e.fr))&&wn(r,`${t}.fr`,"fr must be a finite number"),e.authoredGeometry!==void 0)if(!de(e.authoredGeometry))wn(r,`${t}.authoredGeometry`,"Gradient authoredGeometry must be a plain object");else{let o=n==="linear-gradient"?e1:t1;for(let[s,a]of Object.entries(e.authoredGeometry))o.has(s)?typeof a!="string"&&wn(r,`${t}.authoredGeometry.${s}`,"Authored gradient geometry declarations must be strings"):wn(r,`${t}.authoredGeometry.${s}`,"is not a supported authored gradient geometry field")}e.gradientTransform!==void 0&&(!Array.isArray(e.gradientTransform)||e.gradientTransform.length!==6||!e.gradientTransform.every(o=>typeof o=="number"&&Number.isFinite(o)))&&wn(r,`${t}.gradientTransform`,"gradientTransform must be a 6-element finite affine matrix"),Array.isArray(e.stops)?e.stops.forEach((o,s)=>{if(!de(o)){wn(r,`${t}.stops[${s}]`,"Gradient stop must be an object");return}o.id!==void 0&&(typeof o.id!="string"||o.id.length===0)&&wn(r,`${t}.stops[${s}].id`,"id must be a nonempty string");for(let a of["offset","opacity"])o[a]!==void 0&&(typeof o[a]!="number"||!Number.isFinite(o[a]))&&wn(r,`${t}.stops[${s}].${a}`,`${a} must be a finite number`)}):wn(r,`${t}.stops`,"Gradient stops must be an array")}function i1(e,t,n){if(!de(e)){n.push({path:t,message:"Pattern must be a plain object",severity:"error"});return}if(e.templateId!==void 0&&typeof e.templateId!="string"&&n.push({path:`${t}.templateId`,message:"templateId must be a string",severity:"error"}),e.rootAttributes!==void 0)if(!de(e.rootAttributes))n.push({path:`${t}.rootAttributes`,message:"Pattern rootAttributes must be a plain object",severity:"error"});else for(let[r,i]of Object.entries(e.rootAttributes))zi(r)||n.push({path:`${t}.rootAttributes.${r}`,message:"Pattern root attributes must be safe non-typed attributes",severity:"error"}),typeof i!="string"&&n.push({path:`${t}.rootAttributes.${r}`,message:"Pattern root attribute values must be strings",severity:"error"});for(let r of["x","y","width","height","scale","rotation","opacity"])e[r]!==void 0&&(typeof e[r]!="number"||!Number.isFinite(e[r]))&&n.push({path:`${t}.${r}`,message:`${r} must be a finite number`,severity:"error"});e.patternUnits!==void 0&&e.patternUnits!=="userSpaceOnUse"&&e.patternUnits!=="objectBoundingBox"&&n.push({path:`${t}.patternUnits`,message:"patternUnits must be userSpaceOnUse or objectBoundingBox",severity:"error"}),e.patternContentUnits!==void 0&&e.patternContentUnits!=="userSpaceOnUse"&&e.patternContentUnits!=="objectBoundingBox"&&n.push({path:`${t}.patternContentUnits`,message:"patternContentUnits must be userSpaceOnUse or objectBoundingBox",severity:"error"});for(let r of["svgContent","patternTransform","viewBox","preserveAspectRatio"])e[r]!==void 0&&typeof e[r]!="string"&&n.push({path:`${t}.${r}`,message:`${r} must be a string`,severity:"error"});if(e.authoredGeometry!==void 0)if(!de(e.authoredGeometry))n.push({path:`${t}.authoredGeometry`,message:"Pattern authoredGeometry must be a plain object",severity:"error"});else for(let[r,i]of Object.entries(e.authoredGeometry))n1.has(r)?typeof i!="string"&&n.push({path:`${t}.authoredGeometry.${r}`,message:"Authored pattern geometry declarations must be strings",severity:"error"}):n.push({path:`${t}.authoredGeometry.${r}`,message:"is not a supported authored pattern geometry field",severity:"error"})}var o1={schemaVersion:(e,{errors:t,warnings:n})=>{typeof e!="number"||!Number.isInteger(e)?t.push({path:"schemaVersion",message:"schemaVersion must be an integer",severity:"error"}):e>Tn&&n.push({path:"schemaVersion",message:`schemaVersion ${e} is newer than supported (${Tn})`,severity:"warning"})},shapes:(e,{errors:t,warnings:n})=>{if(!jt(e,"shapes",t))return;let r=new Set;e.forEach((i,o)=>{ch(i,`shapes[${o}]`,t,n,r)})},viewboxes:(e,{errors:t})=>{if(!jt(e,"viewboxes",t))return;let n=new Set;e.forEach((r,i)=>{p1(r,`viewboxes[${i}]`,t,n)})},guides:(e,{errors:t})=>{jt(e,"guides",t)&&e.forEach((n,r)=>{m1(n,`guides[${r}]`,t)})},measurements:(e,{errors:t})=>{jt(e,"measurements",t)&&e.forEach((n,r)=>{let i=`measurements[${r}]`;if(!de(n)){t.push({path:i,message:"Measurement must be a non-null object",severity:"error"});return}(typeof n.id!="string"||n.id.length===0)&&t.push({path:`${i}.id`,message:"Measurement id must be a non-empty string",severity:"error"})})},sceneTree:(e,{doc:t,errors:n,warnings:r})=>{if(!jt(e,"sceneTree",n))return;let i=ah(t.shapes),o=new Set;e.forEach((s,a)=>{s1(s,`sceneTree[${a}]`,n,r,i,o)})},clipMaskGroups:(e,{doc:t,errors:n,warnings:r})=>{if(!jt(e,"clipMaskGroups",n))return;let i=ah(t.shapes),o=br(t);e.forEach((s,a)=>{g1(s,`clipMaskGroups[${a}]`,n,r,i,o)})},documentMetadata:(e,{errors:t})=>{de(e)||t.push({path:"documentMetadata",message:"documentMetadata must be a plain object",severity:"error"})},documentExtensions:(e,{errors:t})=>{if(!jt(e,"documentExtensions",t))return;let n=new Set;e.forEach((r,i)=>J_(r,`documentExtensions[${i}]`,t,n))},definitionContainers:(e,{doc:t,errors:n})=>{if(!jt(e,"definitionContainers",n))return;let r=new Set,i=new Set,o=br(t);e.forEach((s,a)=>{let c=`definitionContainers[${a}]`;if(!de(s)){n.push({path:c,message:"Definition container must be a plain object",severity:"error"});return}typeof s.id!="string"||s.id.length===0?n.push({path:`${c}.id`,message:"Definition container id must be a non-empty string",severity:"error"}):r.has(s.id)?n.push({path:`${c}.id`,message:`Duplicate definition container id: "${s.id}"`,severity:"error"}):r.add(s.id),s.svgId!==void 0&&(typeof s.svgId!="string"||s.svgId.length===0)&&n.push({path:`${c}.svgId`,message:"Definition container svgId must be a non-empty string",severity:"error"}),typeof s.order!="number"||!Number.isInteger(s.order)||s.order<0?n.push({path:`${c}.order`,message:"Definition container order must be a non-negative integer",severity:"error"}):i.has(s.order)?n.push({path:`${c}.order`,message:`Duplicate definition container order: ${s.order}`,severity:"error"}):i.add(s.order),mc(s.authoredPlacement,`${c}.authoredPlacement`,n,o,"Definition container"),s.attributes!==void 0&&jt(s.attributes,`${c}.attributes`,n)&&s.attributes.forEach((l,d)=>{let u=`${c}.attributes[${d}]`;Mk(l,u,n),de(l)&&l.localName==="id"&&l.namespaceUri===null&&n.push({path:u,message:"Definition container attributes must not duplicate svgId authority",severity:"error"})})})},documentScripts:(e,{errors:t})=>{jt(e,"documentScripts",t)&&e.forEach((n,r)=>{let i=`documentScripts[${r}]`;if(!de(n)){t.push({path:i,message:"Document script must be a non-null object",severity:"error"});return}(typeof n.id!="string"||n.id.length===0)&&t.push({path:`${i}.id`,message:"Document script id must be a non-empty string",severity:"error"})})},documentStyles:(e,{doc:t,errors:n})=>{if(!jt(e,"documentStyles",n))return;let r=br(t);e.forEach((i,o)=>{let s=`documentStyles[${o}]`;if(!de(i)){n.push({path:s,message:"Document style must be a non-null object",severity:"error"});return}(typeof i.id!="string"||i.id.length===0)&&n.push({path:`${s}.id`,message:"Document style id must be a non-empty string",severity:"error"}),typeof i.css!="string"&&n.push({path:`${s}.css`,message:"Document style css must be a string",severity:"error"}),i.placement!=="root"&&i.placement!=="defs"&&n.push({path:`${s}.placement`,message:'Document style placement must be "root" or "defs"',severity:"error"}),Rs(i.definitionOrder,`${s}.definitionOrder`,n),Cs(i.definitionContainerId,`${s}.definitionContainerId`,n),mc(i.authoredPlacement,`${s}.authoredPlacement`,n,r,"Document style"),i.scopeDefinitionId!==void 0&&(typeof i.scopeDefinitionId!="string"||i.scopeDefinitionId.length===0)&&n.push({path:`${s}.scopeDefinitionId`,message:"Document style scopeDefinitionId must be a non-empty string",severity:"error"}),i.scopeDefinitionId!==void 0&&i.placement!=="defs"&&n.push({path:`${s}.scopeDefinitionId`,message:"A definition-scoped document style must use defs placement",severity:"error"})})},templateVariables:(e,{errors:t})=>{jt(e,"templateVariables",t)&&e.forEach((n,r)=>{let i=`templateVariables[${r}]`;if(!de(n)){t.push({path:i,message:"Template variable must be a non-null object",severity:"error"});return}(typeof n.name!="string"||n.name.length===0)&&t.push({path:`${i}.name`,message:"Template variable name must be a non-empty string",severity:"error"})})},animationTimeline:(e,{doc:t,errors:n})=>{if(!de(e)){n.push({path:"animationTimeline",message:"animationTimeline must be a plain object",severity:"error"});return}if(e.tracks!==void 0&&!Array.isArray(e.tracks)){n.push({path:"animationTimeline.tracks",message:"animationTimeline.tracks must be an array",severity:"error"});return}if(e.cssAnimationDocumentStylesFingerprint!==void 0&&(typeof e.cssAnimationDocumentStylesFingerprint!="string"||e.cssAnimationDocumentStylesFingerprint.length===0)&&n.push({path:"animationTimeline.cssAnimationDocumentStylesFingerprint",message:"CSS animation document-style fingerprint must be a non-empty string",severity:"error"}),e.cssAnimationInlineStylesFingerprint!==void 0&&(typeof e.cssAnimationInlineStylesFingerprint!="string"||e.cssAnimationInlineStylesFingerprint.length===0)&&n.push({path:"animationTimeline.cssAnimationInlineStylesFingerprint",message:"CSS animation inline-style fingerprint must be a non-empty string",severity:"error"}),e.cssAnimationSources!==void 0)if(!Array.isArray(e.cssAnimationSources))n.push({path:"animationTimeline.cssAnimationSources",message:"CSS animation sources must be an array",severity:"error"});else{let r=new Set,i=new Set;e.cssAnimationSources.forEach((o,s)=>{let a=`animationTimeline.cssAnimationSources[${s}]`;if(!de(o)){n.push({path:a,message:"CSS animation source must be an object",severity:"error"});return}if(typeof o.id!="string"||o.id.length===0?n.push({path:`${a}.id`,message:"CSS animation source id must be a non-empty string",severity:"error"}):r.has(o.id)?n.push({path:`${a}.id`,message:`Duplicate CSS animation source id: "${o.id}"`,severity:"error"}):r.add(o.id),!Array.isArray(o.trackIds)||!Array.isArray(o.trackFingerprints)){n.push({path:a,message:"CSS animation source track ids and fingerprints must be arrays",severity:"error"});return}o.trackIds.length!==o.trackFingerprints.length&&n.push({path:a,message:"CSS animation source track ids and fingerprints must have equal lengths",severity:"error"}),o.trackIds.forEach((c,l)=>{typeof c!="string"||c.length===0?n.push({path:`${a}.trackIds[${l}]`,message:"CSS animation source track id must be a non-empty string",severity:"error"}):i.has(c)?n.push({path:`${a}.trackIds[${l}]`,message:`Duplicate CSS animation source track id: "${c}"`,severity:"error"}):i.add(c)}),o.trackFingerprints.forEach((c,l)=>{(typeof c!="string"||c.length===0)&&n.push({path:`${a}.trackFingerprints[${l}]`,message:"CSS animation track fingerprint must be a non-empty string",severity:"error"})})})}if(Array.isArray(e.tracks)&&Number(t.schemaVersion)>=11){let r=Y_(t.shapes);e.tracks.forEach((i,o)=>{if(!de(i)||!Array.isArray(i.keyframes))return;if(i.sourceCssAnimationId!==void 0&&(typeof i.sourceCssAnimationId!="string"||!i.sourceCssAnimationId)&&n.push({path:`animationTimeline.tracks[${o}].sourceCssAnimationId`,message:"CSS animation source id must be a non-empty string",severity:"error"}),i.definitionTarget!==void 0){let a=`animationTimeline.tracks[${o}].definitionTarget`;if(!de(i.definitionTarget))n.push({path:a,message:"must be an object",severity:"error"});else{let c=i.definitionTarget.definitionId,l=i.definitionTarget.nodeId;if((typeof c!="string"||c.length===0)&&n.push({path:`${a}.definitionId`,message:"must be a non-empty string",severity:"error"}),l!==void 0&&(typeof l!="string"||l.length===0)&&n.push({path:`${a}.nodeId`,message:"must be a non-empty string when present",severity:"error"}),typeof c=="string"&&c.length>0){let d=`definition:${c}${typeof l=="string"&&l.length>0?`/${l}`:""}`;i.shapeId!==d&&n.push({path:`animationTimeline.tracks[${o}].shapeId`,message:`definition target tracks must use ${d}`,severity:"error"})}}}if(i.simpleDuration!==void 0&&i.simpleDuration!=="indefinite"&&n.push({path:`animationTimeline.tracks[${o}].simpleDuration`,message:'SMIL simple duration must be "indefinite" when present',severity:"error"}),i.simpleDuration==="indefinite"&&i.cycleDuration!==void 0&&n.push({path:`animationTimeline.tracks[${o}].cycleDuration`,message:"Finite and indefinite SMIL simple durations are mutually exclusive",severity:"error"}),i.sourceSmilPlacement!==void 0&&i.sourceSmilPlacement!=="document"&&i.sourceSmilPlacement!=="defs"&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilPlacement`,message:'SMIL source placement must be "document" or "defs" when present',severity:"error"}),i.sourceSmilParentTarget!==void 0&&i.sourceSmilParentTarget!==!0&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilParentTarget`,message:"SMIL implicit parent target must be true when present",severity:"error"}),i.sourceSmilParentTarget===!0&&i.sourceSmilPlacement!=="document"&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilPlacement`,message:"SMIL implicit parent target requires document placement",severity:"error"}),i.sourceSmilOrder!==void 0&&(!Number.isInteger(i.sourceSmilOrder)||Number(i.sourceSmilOrder)<0)&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilOrder`,message:"SMIL source order must be a non-negative integer when present",severity:"error"}),i.sourceSmilDefinitionOrder!==void 0&&(!Number.isInteger(i.sourceSmilDefinitionOrder)||Number(i.sourceSmilDefinitionOrder)<0)&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilDefinitionOrder`,message:"SMIL definition order must be a non-negative integer when present",severity:"error"}),i.sourceSmilDefinitionContainerId!==void 0&&(typeof i.sourceSmilDefinitionContainerId!="string"||i.sourceSmilDefinitionContainerId.length===0)&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilDefinitionContainerId`,message:"SMIL definition container id must be a non-empty string when present",severity:"error"}),(i.sourceSmilDefinitionOrder!==void 0||i.sourceSmilDefinitionContainerId!==void 0)&&i.sourceSmilPlacement!=="defs"&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilPlacement`,message:'SMIL definition placement fields require sourceSmilPlacement "defs"',severity:"error"}),i.textPathStartOffsetUnit!==void 0&&i.textPathStartOffsetUnit!=="%"&&i.textPathStartOffsetUnit!=="user"&&n.push({path:`animationTimeline.tracks[${o}].textPathStartOffsetUnit`,message:'Text path start-offset unit must be "%" or "user" when present',severity:"error"}),i.textSpanTarget!==void 0){let a=`animationTimeline.tracks[${o}].textSpanTarget`;if(!de(i.textSpanTarget))n.push({path:a,message:"Text span target must be a plain object",severity:"error"});else{let c=i.textSpanTarget;if((typeof c.attributeName!="string"||c.attributeName.length===0)&&n.push({path:`${a}.attributeName`,message:"Text span target attribute name must be a non-empty string",severity:"error"}),!Array.isArray(c.spanIds)||c.spanIds.length===0||c.spanIds.some(l=>typeof l!="string"||l.length===0)||new Set(c.spanIds).size!==c.spanIds.length)n.push({path:`${a}.spanIds`,message:"Text span target ids must be unique non-empty strings",severity:"error"});else{let l=typeof i.shapeId=="string"?r.get(i.shapeId):void 0;if(!l)n.push({path:a,message:"Text span animation must target a canonical text shape",severity:"error"});else{c.spanIds.forEach((u,f)=>{l.has(u)||n.push({path:`${a}.spanIds[${f}]`,message:`Text span animation target "${u}" does not exist on shape "${i.shapeId}"`,severity:"error"})});let d=c.spanIds.map(u=>l.get(u));if(d.every(u=>u&&typeof u.start=="number"&&Number.isInteger(u.start)&&typeof u.end=="number"&&Number.isInteger(u.end))){let u=d[0].end;d.slice(1).every(p=>{let m=p;return m.start!==u?!1:(u=m.end,!0)})||n.push({path:`${a}.spanIds`,message:"Text span animation target ids must describe one ordered contiguous range",severity:"error"})}}}}}let s=new Set;i.keyframes.forEach((a,c)=>{let l=`animationTimeline.tracks[${o}].keyframes[${c}].id`;if(!de(a)||typeof a.id!="string"||!a.id){n.push({path:l,message:"Animation keyframe id must be a non-empty string",severity:"error"});return}if(s.has(a.id)){n.push({path:l,message:`Duplicate animation keyframe id: "${a.id}"`,severity:"error"});return}s.add(a.id)})})}},library:(e,{doc:t,errors:n,warnings:r})=>{if(!jt(e,"library",n))return;let i=new Set,o=br(t);e.forEach((c,l)=>{let d=`library[${l}]`;if(!de(c)){n.push({path:d,message:"Library def must be a non-null object",severity:"error"});return}if(typeof c.id!="string"||c.id.length===0?n.push({path:`${d}.id`,message:"Library def id must be a non-empty string",severity:"error"}):i.has(c.id)?n.push({path:`${d}.id`,message:`Duplicate library def id: "${c.id}"`,severity:"error"}):i.add(c.id),(typeof c.kind!="string"||c.kind.length===0)&&n.push({path:`${d}.kind`,message:"Library def kind must be a non-empty string",severity:"error"}),c.definitionPlacement!==void 0&&!["defs","document"].includes(String(c.definitionPlacement))&&n.push({path:`${d}.definitionPlacement`,message:"Library definitionPlacement must be defs or document",severity:"error"}),Rs(c.definitionOrder,`${d}.definitionOrder`,n),Cs(c.definitionContainerId,`${d}.definitionContainerId`,n),mc(c.authoredPlacement,`${d}.authoredPlacement`,n,o,"Library"),c.kind==="symbol"||c.kind==="marker"){let u=ah(c.shapes);if(typeof c.id=="string"&&c.id.length>0&&u.add(c.id),q_(c.animations,`${d}.animations`,u,n),c.kind==="symbol"){let f=typeof t.schemaVersion=="number"&&t.schemaVersion>=8;if(c.defKind!==void 0&&!["symbol","group","shape"].includes(String(c.defKind))&&n.push({path:`${d}.defKind`,message:"Symbol defKind must be symbol, group, or shape",severity:"error"}),c.definitionPlacement==="document"&&(c.defKind??"symbol")!=="symbol"&&n.push({path:`${d}.definitionPlacement`,message:"Only symbol roots may use document definition placement",severity:"error"}),c.defKind==="shape"&&(!Array.isArray(c.shapes)||c.shapes.length!==1)&&n.push({path:`${d}.shapes`,message:"Native shape definitions must contain exactly one root shape",severity:"error"}),f)for(let p of["wrapperAttrs","groups","overflow"])c[p]!==void 0&&n.push({path:`${d}.${p}`,message:`Symbol ${p} is schema-v7 migration input only`,severity:"error"});for(let p of["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"])c[p]!==void 0&&typeof c[p]!="string"&&n.push({path:`${d}.${p}`,message:`Symbol ${p} must be a string when present`,severity:"error"});if(c.rootAttributes!==void 0)if(!de(c.rootAttributes))n.push({path:`${d}.rootAttributes`,message:"Symbol rootAttributes must be a plain object",severity:"error"});else for(let[p,m]of Object.entries(c.rootAttributes))f&&["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(p)&&n.push({path:`${d}.rootAttributes.${p}`,message:`Symbol ${p} must use its typed root field`,severity:"error"}),typeof m!="string"&&n.push({path:`${d}.rootAttributes.${p}`,message:"Symbol root attribute values must be strings",severity:"error"});if(c.definitionContentOrder!==void 0)if(!Array.isArray(c.definitionContentOrder))n.push({path:`${d}.definitionContentOrder`,message:"Symbol definitionContentOrder must be an array",severity:"error"});else{let p=new Set(Array.isArray(c.shapes)?c.shapes.filter(g=>de(g)).map(g=>g.id).filter(g=>typeof g=="string"&&g.length>0):[]),m=new Set;c.definitionContentOrder.forEach((g,h)=>{let y=`${d}.definitionContentOrder[${h}]`;if(!de(g)){n.push({path:y,message:"Definition content entry must be a plain object",severity:"error"});return}if(g.kind!=="shape"&&g.kind!=="definition"&&n.push({path:`${y}.kind`,message:"Definition content kind must be shape or definition",severity:"error"}),typeof g.id!="string"||g.id.length===0){n.push({path:`${y}.id`,message:"Definition content id must be a non-empty string",severity:"error"});return}let S=`${String(g.kind)}\0${g.id}`;m.has(S)&&n.push({path:y,message:`Duplicate definition content entry: ${String(g.kind)} "${g.id}"`,severity:"error"}),m.add(S),g.kind==="shape"&&!p.has(g.id)&&n.push({path:`${y}.id`,message:`Definition content shape "${g.id}" is not a root shape of this definition`,severity:"error"})})}}if(c.kind==="marker"){for(let f of["viewBox","preserveAspectRatio"])c[f]!==void 0&&typeof c[f]!="string"&&n.push({path:`${d}.${f}`,message:`Marker ${f} must be a string when present`,severity:"error"});if(c.authoredGeometry!==void 0)if(!de(c.authoredGeometry))n.push({path:`${d}.authoredGeometry`,message:"Marker authoredGeometry must be a plain object",severity:"error"});else for(let[f,p]of Object.entries(c.authoredGeometry))typeof p!="string"&&n.push({path:`${d}.authoredGeometry.${f}`,message:"Marker authored geometry declarations must be strings",severity:"error"});if(c.rootAttributes!==void 0)if(!de(c.rootAttributes))n.push({path:`${d}.rootAttributes`,message:"Marker rootAttributes must be a plain object",severity:"error"});else for(let[f,p]of Object.entries(c.rootAttributes))["id","viewBox","preserveAspectRatio","refX","refY","markerWidth","markerHeight","markerUnits","orient"].includes(f)&&n.push({path:`${d}.rootAttributes.${f}`,message:`Marker ${f} must use its typed root field`,severity:"error"}),typeof p!="string"&&n.push({path:`${d}.rootAttributes.${f}`,message:"Marker root attribute values must be strings",severity:"error"})}if(Array.isArray(c.shapes)){let f=new Set;c.shapes.forEach((p,m)=>{ch(p,`${d}.shapes[${m}]`,n,r,f)})}if(c.kind==="symbol"&&de(c.variants))for(let[f,p]of Object.entries(c.variants)){if(!Array.isArray(p))continue;let m=new Set;p.forEach((g,h)=>{ch(g,`${d}.variants[${f}][${h}]`,n,r,m)})}}(c.kind==="linear-gradient"||c.kind==="radial-gradient")&&r1(c.gradient,`${d}.gradient`,c.kind,n),c.kind==="pattern"&&i1(c.pattern,`${d}.pattern`,n),c.kind==="appearance-style"&&c1(c.layers,`${d}.layers`,n)});let s=new Map;e.forEach((c,l)=>{de(c)&&c.kind==="symbol"&&typeof c.id=="string"&&c.id.length>0&&s.set(c.id,{def:c,index:l})});let a=new Map;for(let[c,{def:l,index:d}]of s)Array.isArray(l.definitionContentOrder)&&l.definitionContentOrder.forEach((u,f)=>{if(!de(u)||u.kind!=="definition"||typeof u.id!="string")return;let p=`library[${d}].definitionContentOrder[${f}].id`;if(u.id===c){n.push({path:p,message:`Symbol definition "${c}" cannot contain itself`,severity:"error"});return}if(!s.has(u.id)){n.push({path:p,message:`Nested symbol definition "${u.id}" does not exist`,severity:"error"});return}let m=a.get(u.id);if(m&&m!==c){n.push({path:p,message:`Nested symbol definition "${u.id}" already belongs to "${m}"`,severity:"error"});return}a.set(u.id,c)});for(let c of s.keys()){let l=new Set,d=c;for(;d!==void 0;){if(l.has(d)){let u=s.get(c);n.push({path:`library[${u?.index??0}].definitionContentOrder`,message:`Symbol definition forest contains a cycle through "${d}"`,severity:"error"});break}l.add(d),d=a.get(d)}}},paintServerDefs:(e,{doc:t,errors:n})=>{if(!jt(e,"paintServerDefs",n))return;let r=new Set,i=br(t);e.forEach((o,s)=>{l1(o,`paintServerDefs[${s}]`,n,r,i)})},colorGlyphLibrary:(e,{errors:t})=>{if(!de(e)){t.push({path:"colorGlyphLibrary",message:"colorGlyphLibrary must be a plain object",severity:"error"});return}e.version!==void 0&&!Number.isInteger(e.version)&&t.push({path:"colorGlyphLibrary.version",message:"colorGlyphLibrary.version must be an integer",severity:"error"}),e.entries!==void 0&&!Array.isArray(e.entries)&&t.push({path:"colorGlyphLibrary.entries",message:"colorGlyphLibrary.entries must be an array",severity:"error"})},exportItems:(e,{errors:t})=>{jt(e,"exportItems",t)&&e.forEach((n,r)=>{let i=`exportItems[${r}]`;if(!de(n)){t.push({path:i,message:"Export item must be a non-null object",severity:"error"});return}(typeof n.id!="string"||n.id.length===0)&&t.push({path:`${i}.id`,message:"Export item id must be a non-empty string",severity:"error"}),typeof n.filename!="string"&&t.push({path:`${i}.filename`,message:"Export item filename must be a string",severity:"error"}),typeof n.format!="string"&&t.push({path:`${i}.format`,message:"Export item format must be a string",severity:"error"})})},unknownFields:(e,{errors:t})=>{de(e)||t.push({path:"unknownFields",message:"unknownFields must be a plain object (forward-compat quarantine bag)",severity:"error"})}};function ah(e){let t=new Set;if(!Array.isArray(e))return t;for(let n of e)In(n,{onShape:r=>{typeof r.id=="string"&&r.id.length>0&&t.add(r.id)}});return t}function Dk(e){return e.startsWith("structural:")}function s1(e,t,n,r,i,o){if(e===null||typeof e!="object"){n.push({path:t,message:"Scene tree entry must be a non-null object",severity:"error"});return}let s=e;typeof s.id!="string"||s.id.length===0?n.push({path:`${t}.id`,message:"Scene tree id must be a non-empty string",severity:"error"}):(o.has(s.id)&&n.push({path:`${t}.id`,message:`Duplicate scene tree id: "${s.id}"`,severity:"error"}),o.add(s.id),!i.has(s.id)&&!Dk(s.id)&&r.push({path:`${t}.id`,message:`Scene tree id "${s.id}" is not present in shapes`,severity:"warning"})),s.parentId!==null&&typeof s.parentId!="string"?n.push({path:`${t}.parentId`,message:"Scene tree parentId must be a string or null",severity:"error"}):typeof s.parentId=="string"&&!i.has(s.parentId)&&!Dk(s.parentId)&&r.push({path:`${t}.parentId`,message:`Scene tree parentId "${s.parentId}" is not present in shapes`,severity:"warning"}),(typeof s.index!="number"||!Number.isInteger(s.index)||s.index<0)&&n.push({path:`${t}.index`,message:"Scene tree index must be a non-negative integer",severity:"error"}),s.updatedAt!==void 0&&(typeof s.updatedAt!="number"||!Number.isFinite(s.updatedAt)||s.updatedAt<0)&&n.push({path:`${t}.updatedAt`,message:"Scene tree updatedAt must be a non-negative finite number",severity:"error"}),s.clientId!==void 0&&typeof s.clientId!="string"&&n.push({path:`${t}.clientId`,message:"Scene tree clientId must be a string",severity:"error"})}var a1=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]);function mc(e,t,n,r,i){if(e===void 0)return;if(!de(e)){n.push({path:t,message:`${i} authoredPlacement must be an object`,severity:"error"});return}let o=e.parentId,s=e.parentDefinitionId,a=e.siblingIndex,c=!0;if((typeof o!="string"||o.length===0)&&(n.push({path:`${t}.parentId`,message:"Definition placement parentId must be a non-empty string",severity:"error"}),c=!1),s!==void 0&&(typeof s!="string"||s.length===0)&&(n.push({path:`${t}.parentDefinitionId`,message:"Definition placement parentDefinitionId must be a non-empty string when present",severity:"error"}),c=!1),c){let l=r.resolve(e);l.kind==="missing"?n.push({path:s===void 0?`${t}.parentId`:`${t}.parentDefinitionId`,message:s===void 0?`Definition placement parentId "${String(o)}" does not exist`:`Definition placement parent "${String(o)}" does not exist in library definition "${String(s)}"`,severity:"error"}):l.kind==="ambiguous"&&n.push({path:`${t}.parentId`,message:`Definition placement parentId "${String(o)}" is ambiguous across library definitions: ${l.definitionIds.join(", ")}`,severity:"error"})}(typeof a!="number"||!Number.isInteger(a)||a<0)&&n.push({path:`${t}.siblingIndex`,message:"Definition placement siblingIndex must be a non-negative integer",severity:"error"})}function c1(e,t,n){if(!Array.isArray(e)){n.push({path:t,message:"Appearance style layers must be an array",severity:"error"});return}let r=new Set;e.forEach((i,o)=>{let s=`${t}[${o}]`;if(!de(i)){n.push({path:s,message:"Appearance style layer must be an object",severity:"error"});return}if(i.kind!=="fill"&&i.kind!=="stroke"&&n.push({path:`${s}.kind`,message:"Appearance style layer kind must be fill or stroke",severity:"error"}),typeof i.id!="string"||i.id.length===0){n.push({path:`${s}.id`,message:"Appearance style layer id must be a non-empty string",severity:"error"});return}r.has(i.id)?n.push({path:`${s}.id`,message:`Duplicate appearance style layer id: "${i.id}"`,severity:"error"}):r.add(i.id)})}function l1(e,t,n,r,i){if(e===null||typeof e!="object"){n.push({path:t,message:"Paint server def must be a non-null object",severity:"error"});return}let o=e;typeof o.id!="string"||o.id.length===0?n.push({path:`${t}.id`,message:"Paint server def id must be a non-empty string",severity:"error"}):r.has(o.id)?n.push({path:`${t}.id`,message:`Duplicate paint server def id: "${o.id}"`,severity:"error"}):r.add(o.id),o.sourceId!==void 0&&(typeof o.sourceId!="string"||o.sourceId.length===0)&&n.push({path:`${t}.sourceId`,message:"Paint server def sourceId must be a non-empty string when present",severity:"error"});let s=o.role===void 0?"resource":o.role;s!=="resource"&&s!=="referenced-fragment"&&n.push({path:`${t}.role`,message:"Paint server def role must be resource or referenced-fragment",severity:"error"}),typeof o.type=="string"&&(s==="resource"&&a1.has(o.type)||s==="referenced-fragment"&&/^[A-Za-z][\w.-]*$/u.test(o.type))||n.push({path:`${t}.type`,message:"Paint server def type must be a supported SVG defs element type",severity:"error"}),(typeof o.markup!="string"||o.markup.length===0)&&n.push({path:`${t}.markup`,message:"Paint server def markup must be a non-empty string",severity:"error"}),o.passthrough!==void 0&&typeof o.passthrough!="boolean"&&n.push({path:`${t}.passthrough`,message:"Paint server def passthrough must be a boolean when present",severity:"error"});for(let c of["definitionChildIds","sourceDefinitionChildIds"]){let l=o[c];l!==void 0&&(!Array.isArray(l)||l.some(d=>typeof d!="string"||d.length===0))&&n.push({path:`${t}.${c}`,message:"Definition child ids must be non-empty strings",severity:"error"})}Array.isArray(o.definitionChildIds)&&Array.isArray(o.sourceDefinitionChildIds)&&o.definitionChildIds.length!==o.sourceDefinitionChildIds.length&&n.push({path:t,message:"Definition child id arrays must have equal lengths",severity:"error"}),mc(o.authoredPlacement,`${t}.authoredPlacement`,n,i,"Paint server def"),Rs(o.definitionOrder,`${t}.definitionOrder`,n),Cs(o.definitionContainerId,`${t}.definitionContainerId`,n)}function ch(e,t,n,r,i){if(e===null||typeof e!="object"||Array.isArray(e)){n.push({path:t,message:"Shape must be a non-null object",severity:"error"});return}In(e,{onShape:(o,s)=>{d1(o,`${t}${s}`,n,r,i)}})}function d1(e,t,n,r,i){if(typeof e.id!="string"||e.id.length===0?n.push({path:`${t}.id`,message:"Shape id must be a non-empty string",severity:"error"}):i.has(e.id)?n.push({path:`${t}.id`,message:`Duplicate shape id: "${e.id}"`,severity:"error"}):i.add(e.id),typeof e.type!="string"?n.push({path:`${t}.type`,message:"Shape type must be a string",severity:"error"}):X_().has(e.type)||r.push({path:`${t}.type`,message:`Unknown shape type: "${e.type}"`,severity:"warning"}),e.state===void 0||e.state===null||typeof e.state!="object")n.push({path:`${t}.state`,message:"Shape state must be a non-null object",severity:"error"});else{let o=e.state;f1(o,`${t}.state`,n,r),e.type==="foreign-object"&&(Object.hasOwn(o,"rawContent")&&n.push({path:`${t}.state.rawContent`,message:"rawContent is noncanonical; use structured foreignContent nodes",severity:"error"}),o.foreignContent!==void 0&&jt(o.foreignContent,`${t}.state.foreignContent`,n)&&o.foreignContent.forEach((s,a)=>zk(s,`${t}.state.foreignContent[${a}]`,n))),o.children!==void 0&&!Array.isArray(o.children)?n.push({path:`${t}.state.children`,message:"children must be an array",severity:"error"}):Array.isArray(o.children)&&o.children.forEach((s,a)=>{(s===null||typeof s!="object"||Array.isArray(s))&&n.push({path:`${t}.state.children[${a}]`,message:"Shape must be a non-null object",severity:"error"})})}}var u1=/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/;function $k(e){return typeof e=="number"?isFinite(e):typeof e=="string"?u1.test(e):!1}function f1(e,t,n,r){if(Rs(e.definitionOrder,`${t}.definitionOrder`,n),Cs(e.definitionContainerId,`${t}.definitionContainerId`,n),de(e.metadata))for(let s of["linkUrl","linkTarget"])Object.hasOwn(e.metadata,s)&&n.push({path:`${t}.metadata.${s}`,message:`${s} is noncanonical; use a Hyperlink container shape`,severity:"error"});if((e.fillType==="linear-gradient"||e.fillType==="radial-gradient"||e.fillType==="pattern")&&e.fillColor==="none"&&e.fillOpacity===0&&n.push({path:`${t}.fillOpacity`,message:"Painted shapes cannot carry the noncanonical no-fill opacity encoding",severity:"error"}),e.charOffsets!==void 0&&e.charOffsets!==null&&(Array.isArray(e.charOffsets)?e.charOffsets.forEach((s,a)=>{let c=`${t}.charOffsets[${a}]`;if(!de(s)){n.push({path:c,message:"Each charOffsets entry must be a plain object",severity:"error"});return}for(let l of["x","y"]){let d=s[l];d!==null&&(typeof d!="number"||!Number.isFinite(d))&&n.push({path:`${c}.${l}`,message:`${l} must be null or a finite number`,severity:"error"})}for(let l of["dx","dy","rotate"]){let d=s[l];(typeof d!="number"||!Number.isFinite(d))&&n.push({path:`${c}.${l}`,message:`${l} must be a finite number`,severity:"error"})}if(s.raw!==void 0)if(!de(s.raw))n.push({path:`${c}.raw`,message:"raw must be a plain object",severity:"error"});else for(let[l,d]of Object.entries(s.raw))(!["x","y","dx","dy"].includes(l)||typeof d!="string")&&n.push({path:`${c}.raw.${l}`,message:"raw accepts only string x/y/dx/dy members",severity:"error"})}):n.push({path:`${t}.charOffsets`,message:"charOffsets must be an array",severity:"error"})),e.textPathReference!==void 0&&e.textPathReference!==null){let s=e.textPathReference;(!de(s)||s.kind!=="shape"&&s.kind!=="definition"||typeof s.targetId!="string"||s.targetId.length===0||s.element!=="href"&&s.element!=="mpath"||Object.keys(s).some(a=>!["kind","targetId","element"].includes(a)))&&n.push({path:`${t}.textPathReference`,message:"textPathReference requires an exact shape/definition target and href/mpath element",severity:"error"})}for(let s of["textPathRefShapeId","textPathImportRefId"])e[s]!==void 0&&n.push({path:`${t}.${s}`,message:`${s} is noncanonical; use textPathReference`,severity:"error"});if(e.authoredTextPosition!==void 0)if(!de(e.authoredTextPosition))n.push({path:`${t}.authoredTextPosition`,message:"authoredTextPosition must be a plain object",severity:"error"});else for(let[s,a]of Object.entries(e.authoredTextPosition)){let c=`${t}.authoredTextPosition.${s}`;if(!["x","y"].includes(s)||!de(a)){n.push({path:c,message:"Authored text position accepts only x/y coordinate objects",severity:"error"});continue}(typeof a.raw!="string"||a.raw.length===0||typeof a.resolved!="number"||!Number.isFinite(a.resolved))&&n.push({path:c,message:"Authored text coordinates require non-empty raw and finite resolved values",severity:"error"});for(let l of Object.keys(a))["raw","resolved"].includes(l)||n.push({path:`${c}.${l}`,message:"Authored text coordinates accept only raw/resolved members",severity:"error"})}if(e.textSpanTree!==void 0){let s=`${t}.textSpanTree`;if(!de(e.textSpanTree))n.push({path:s,message:"textSpanTree must be a plain object",severity:"error"});else{let a=e.textSpanTree,c=a.text,l=a.spans;if(typeof c!="string"||!Array.isArray(l))n.push({path:s,message:"Text span trees require text and spans",severity:"error"});else{let d=new Set,u=(f,p,m,g)=>{let h=p;f.forEach((y,S)=>{let b=`${g}[${S}]`,I=de(y)?y.start:void 0,v=de(y)?y.end:void 0,w=de(y)?y.children:void 0,k=de(y)?y.spanId:void 0,C=de(y)?y.id:void 0,P=de(y)?y.lineIndex:void 0,R=de(y)?y.rotate:void 0;!de(y)||typeof I!="number"||typeof v!="number"||!Number.isInteger(I)||!Number.isInteger(v)||I<h||v<I||I<p||v>m||!Array.isArray(w)||typeof k!="string"||k.length===0||d.has(k)||C!==void 0&&(typeof C!="string"||C.length===0)||P!==void 0&&(typeof P!="number"||!Number.isInteger(P)||P<0)||R!==void 0&&(!Array.isArray(R)||R.length===0||R.some(N=>typeof N!="number"||!Number.isFinite(N)))||Object.keys(y).some(N=>!["spanId","start","end","id","lineIndex","rotate","children"].includes(N))?n.push({path:b,message:"Text span nodes require nested ordered ranges, child arrays, and valid optional identity/line fields",severity:"error"}):(d.add(k),u(w,I,v,`${b}.children`),h=v)})};u(l,0,c.length,`${s}.spans`),a.rotate!==void 0&&(!Array.isArray(a.rotate)||a.rotate.length===0||a.rotate.some(f=>typeof f!="number"||!Number.isFinite(f)))&&n.push({path:`${s}.rotate`,message:"Text span root rotate must be a non-empty finite number list",severity:"error"});for(let f of Object.keys(a))["text","rotate","spans"].includes(f)||n.push({path:`${s}.${f}`,message:"Text span trees accept only text/spans members",severity:"error"})}}}if(e.authoredUseGeometry!==void 0)if(!de(e.authoredUseGeometry))n.push({path:`${t}.authoredUseGeometry`,message:"authoredUseGeometry must be a plain object",severity:"error"});else for(let[s,a]of Object.entries(e.authoredUseGeometry))(!["x","y","width","height"].includes(s)||typeof a!="string")&&n.push({path:`${t}.authoredUseGeometry.${s}`,message:"Authored use geometry accepts only string x/y/width/height members",severity:"error"});let i=["x","y","width","height","radius","rx","ry","fontSize"];for(let s of i)e[s]!==void 0&&!$k(e[s])&&n.push({path:`${t}.${s}`,message:`${s} must be a finite number or a {{variable}} reference`,severity:"error"});for(let s of ul){let a=e[s];if(a!=null){if(s==="transformMatrix"){(!Array.isArray(a)||a.length<6||!a.slice(0,6).every(c=>typeof c=="number"&&Number.isFinite(c)))&&n.push({path:`${t}.${s}`,message:`${s} must be a 6-element finite affine matrix`,severity:"error"});continue}$k(a)||n.push({path:`${t}.${s}`,message:`${s} must be a finite number or a {{variable}} reference`,severity:"error"})}}let o=["width","height","radius","fontSize"];for(let s of o){let a=e[s];typeof a=="number"&&a<=0&&r.push({path:`${t}.${s}`,message:`${s} should be positive (got ${a})`,severity:"warning"})}}function p1(e,t,n,r){if(e===null||typeof e!="object"){n.push({path:t,message:"Viewbox must be a non-null object",severity:"error"});return}let i=e;typeof i.id!="string"||i.id.length===0?n.push({path:`${t}.id`,message:"Viewbox id must be a non-empty string",severity:"error"}):r.has(i.id)?n.push({path:`${t}.id`,message:`Duplicate viewbox id: "${i.id}"`,severity:"error"}):r.add(i.id);for(let o of["x","y","width","height"])(typeof i[o]!="number"||!isFinite(i[o]))&&n.push({path:`${t}.${o}`,message:`${o} must be a finite number`,severity:"error"});typeof i.width=="number"&&i.width<=0&&n.push({path:`${t}.width`,message:"Viewbox width must be positive",severity:"error"}),typeof i.height=="number"&&i.height<=0&&n.push({path:`${t}.height`,message:"Viewbox height must be positive",severity:"error"})}function m1(e,t,n){if(e===null||typeof e!="object"){n.push({path:t,message:"Guide must be a non-null object",severity:"error"});return}let r=e;(typeof r.id!="string"||r.id.length===0)&&n.push({path:`${t}.id`,message:"Guide id must be a non-empty string",severity:"error"}),r.orientation!=="horizontal"&&r.orientation!=="vertical"&&n.push({path:`${t}.orientation`,message:'Guide orientation must be "horizontal" or "vertical"',severity:"error"}),(typeof r.position!="number"||!isFinite(r.position))&&n.push({path:`${t}.position`,message:"Guide position must be a finite number",severity:"error"})}function g1(e,t,n,r,i,o){if(e===null||typeof e!="object"){n.push({path:t,message:"ClipMaskGroup must be a non-null object",severity:"error"});return}let s=e;(typeof s.id!="string"||s.id.length===0)&&n.push({path:`${t}.id`,message:"ClipMaskGroup id must be a non-empty string",severity:"error"}),s.type!=="clip"&&s.type!=="mask"&&n.push({path:`${t}.type`,message:'ClipMaskGroup type must be "clip" or "mask"',severity:"error"}),s.definitionPlacement!==void 0&&s.definitionPlacement!=="defs"&&s.definitionPlacement!=="document"&&n.push({path:`${t}.definitionPlacement`,message:'definitionPlacement must be "defs" or "document"',severity:"error"}),s.referenceChannel!==void 0&&s.referenceChannel!=="attribute"&&s.referenceChannel!=="style"&&s.referenceChannel!=="stylesheet"&&n.push({path:`${t}.referenceChannel`,message:'referenceChannel must be "attribute", "style", or "stylesheet"',severity:"error"}),s.referenceStyleOrder!==void 0&&(typeof s.referenceStyleOrder!="number"||!Number.isInteger(s.referenceStyleOrder)||s.referenceStyleOrder<0)&&n.push({path:`${t}.referenceStyleOrder`,message:"referenceStyleOrder must be a non-negative integer",severity:"error"}),Rs(s.definitionOrder,`${t}.definitionOrder`,n),Cs(s.definitionContainerId,`${t}.definitionContainerId`,n),mc(s.authoredPlacement,`${t}.authoredPlacement`,n,o,"Clip/mask");let a=s.clipShapeIds,c=typeof s.rawDefinition=="string"&&s.rawDefinition.length>0;a!==void 0&&!Array.isArray(a)?n.push({path:`${t}.clipShapeIds`,message:"clipShapeIds must be an array",severity:"error"}):a===void 0?n.push({path:`${t}.clipShapeIds`,message:"ClipMaskGroup must carry clipShapeIds",severity:"error"}):Array.isArray(a)&&a.length===0&&!c&&r.push({path:`${t}.clipShapeIds`,message:"ClipMaskGroup has no clip shapes and no rawDefinition; it will clip nothing",severity:"warning"}),Array.isArray(s.contentShapeIds)||n.push({path:`${t}.contentShapeIds`,message:"contentShapeIds must be an array",severity:"error"})}function on(e){let t=[...e].sort((i,o)=>i.index-o.index);if(!t.some(i=>i.orderKey))return t;let n=Uf(t.length),r=new Map;return t.forEach((i,o)=>{r.set(i.id,i.orderKey??n[o])}),t.sort((i,o)=>{let s=gl(r.get(i.id)??"",r.get(o.id)??"");return s!==0?s:i.id<o.id?-1:i.id>o.id?1:0})}function Ut(e){return e.definitionId??`${e.type}-${e.id}`}function lh(e){return e.rawDefinition!==void 0?!0:e.clipShapeIds.length===0}function dh(e){let t=lh(e);return e.type==="clip"?{type:"clip",...e.definitionPlacement!==void 0?{definitionPlacement:e.definitionPlacement}:{},...e.definitionOrder!==void 0?{definitionOrder:e.definitionOrder}:{},...e.definitionContainerId!==void 0?{definitionContainerId:e.definitionContainerId}:{},...e.authoredPlacement!==void 0?{authoredPlacement:structuredClone(e.authoredPlacement)}:{},...e.clipPathUnits!==void 0?{clipPathUnits:e.clipPathUnits}:{},...!t&&e.clipRule!==void 0?{clipRule:e.clipRule}:{},...t&&e.rawDefinition!==void 0?{rawDefinition:e.rawDefinition}:{}}:{type:"mask",...e.definitionPlacement!==void 0?{definitionPlacement:e.definitionPlacement}:{},...e.definitionOrder!==void 0?{definitionOrder:e.definitionOrder}:{},...e.definitionContainerId!==void 0?{definitionContainerId:e.definitionContainerId}:{},...e.authoredPlacement!==void 0?{authoredPlacement:structuredClone(e.authoredPlacement)}:{},...e.maskUnits!==void 0?{maskUnits:e.maskUnits}:{},...e.maskContentUnits!==void 0?{maskContentUnits:e.maskContentUnits}:{},...e.maskType!==void 0?{maskType:e.maskType}:{},...e.maskBounds!==void 0?{maskBounds:structuredClone(e.maskBounds)}:{},...t&&e.rawDefinition!==void 0?{rawDefinition:e.rawDefinition}:{}}}function As(e,t,n){let{clipPathUnits:r,clipRule:i,maskUnits:o,maskContentUnits:s,maskType:a,maskBounds:c,definitionPlacement:l,definitionOrder:d,definitionContainerId:u,authoredPlacement:f,rawDefinition:p,...m}=structuredClone(e),g=t.rawDefinition!==void 0||lh(e);return e.type==="clip"?{...m,type:"clip",...t.definitionPlacement!==void 0?{definitionPlacement:t.definitionPlacement}:{},...t.definitionOrder!==void 0?{definitionOrder:t.definitionOrder}:{},...t.definitionContainerId!==void 0?{definitionContainerId:t.definitionContainerId}:{},...t.authoredPlacement!==void 0?{authoredPlacement:structuredClone(t.authoredPlacement)}:{},...t.clipPathUnits!==void 0?{clipPathUnits:t.clipPathUnits}:{},...!g&&t.clipRule!==void 0?{clipRule:t.clipRule}:{},...g&&n&&t.rawDefinition!==void 0?{rawDefinition:t.rawDefinition}:{}}:{...m,type:"mask",...t.definitionPlacement!==void 0?{definitionPlacement:t.definitionPlacement}:{},...t.definitionOrder!==void 0?{definitionOrder:t.definitionOrder}:{},...t.definitionContainerId!==void 0?{definitionContainerId:t.definitionContainerId}:{},...t.authoredPlacement!==void 0?{authoredPlacement:structuredClone(t.authoredPlacement)}:{},...t.maskUnits!==void 0?{maskUnits:t.maskUnits}:{},...t.maskContentUnits!==void 0?{maskContentUnits:t.maskContentUnits}:{},...t.maskType!==void 0?{maskType:t.maskType}:{},...t.maskBounds!==void 0?{maskBounds:structuredClone(t.maskBounds)}:{},...g&&n&&t.rawDefinition!==void 0?{rawDefinition:t.rawDefinition}:{}}}function ui(e){let t=new Map;for(let n of e??[]){let r=Ut(n),i=dh(n),o=t.get(r);t.set(r,o?.type===i.type?{...o,...i}:i)}return t}function rr(e){let t=structuredClone(e??[]),n=ui(t),r=new Set;return t.map(i=>{let o=Ut(i),s=n.get(o)??dh(i),a=s.rawDefinition!==void 0&&!r.has(o);return a&&r.add(o),As(i,s,a)})}function Bi(e,t){let n=structuredClone(e??[]);if(t.type==="clipMask:remove"){let c=n.find(p=>p.id===t.id);if(!c)return rr(n);let l=Ut(c),d=ui(n).get(l),u=n.filter(p=>p.id!==t.id),f=u.findIndex(p=>Ut(p)===l);return d&&f>=0&&(u[f]=As(u[f],d,!0)),rr(u)}let r=n.findIndex(c=>c.id===t.clipMaskGroup.id),i=r>=0?n[r]:void 0,o=i?ui(n).get(Ut(i)):void 0;r>=0&&n.splice(r,1);let s=Math.min(Math.max(0,t.index??n.length),n.length),a=structuredClone(t.clipMaskGroup);return o?.rawDefinition!==void 0&&a.rawDefinition===void 0&&Ut(i)===Ut(a)&&(a=As(a,o,!0)),n.splice(s,0,a),rr(n)}function uh(e,t,n,r){if(!e.some(o=>o.id===t))throw new Error(`Unknown clip/mask group: ${t}`);let i=e.map(o=>o.id===t?As({...o,definitionId:n},r,r.rawDefinition!==void 0):Ut(o)!==n?structuredClone(o):As(o,r,!1));return rr(i)}var h1=/^structural:(clip|mask):(.+):(group|path|content)$/;function Fk(e,t){let n=`structural:${e}:${t}`;return{group:`${n}:group`,path:`${n}:path`,content:`${n}:content`}}function Lk(e,t){for(let n of e){t.add(n.id);let r=n.state.children;Array.isArray(r)&&Lk(r,t)}}function _k(e,t=null){let n=[];return e.forEach((r,i)=>{n.push({id:r.id,parentId:t,index:i});let o=r.state.children;Array.isArray(o)&&n.push(..._k(o,r.id))}),n}function jr(e){let t=e.sceneTree&&e.sceneTree.length>0?e.sceneTree:_k(e.shapes),n=new Map(t.map(v=>[v.id,v])),r=new Map;for(let v of t){let w=r.get(v.parentId)??[];w.push(v),r.set(v.parentId,w)}for(let[v,w]of r)r.set(v,on(w));let i=v=>h1.test(v),o=new Set(t.filter(v=>!i(v.id)).map(v=>v.id)),s=new Set;Lk(e.shapes,s);let a=new Map,c=new Set,l=(v,w)=>{let k=[];for(let C of r.get(v)??[]){if(!i(C.id)){c.has(C.id)||(c.add(C.id),k.push(C.id));continue}if(w.has(C.id))continue;let P=new Set(w);P.add(C.id),k.push(...l(C.id,P))}return k},d=[null,...o];for(let v of d){let w=l(v,new Set);w.length>0&&a.set(v,w)}for(let v of o){if(c.has(v))continue;let w=n.get(v)?.parentId??null,k=w!==null&&o.has(w)?w:null,C=a.get(k)??[];C.push(v),a.set(k,C),c.add(v)}let u=v=>{for(let[w,k]of a){let C=k.indexOf(v);if(C>=0)return{parentId:w,index:C}}return null},f=v=>{for(let w of a.values()){let k=w.indexOf(v);k>=0&&w.splice(k,1)}},p=e.clipMaskGroups??[],m=ui(p),g=new Set(p.filter(v=>v.clipShapeIds.some(w=>s.has(w))).map(v=>`${v.type}\0${Ut(v)}`)),h=new Map(p.map(v=>[Fk(v.type,v.id).content,v])),y=(v,w=new Set)=>{if(w.has(v.id))return Number.MAX_SAFE_INTEGER;let k=v.parentId?h.get(v.parentId):void 0;if(!k)return 0;let C=new Set(w);return C.add(v.id),1+y(k,C)},S=[...p].sort((v,w)=>y(v)-y(w)||(v.siblingIndex??0)-(w.siblingIndex??0)),b=new Map;for(let v of S){let w=v.clipShapeIds.filter(W=>s.has(W)),k=v.contentShapeIds.filter(W=>s.has(W)),C=Ut(v),R=m.get(C)?.rawDefinition!==void 0||g.has(`${v.type}\0${C}`);if(k.length===0||!R)continue;let N=[...k,...w].map(u).filter(W=>W!==null),M=N[0]?.parentId??null,A=N.length>0?Math.min(...N.map(W=>W.index)):void 0,$=v.parentId===null||o.has(v.parentId)||h.has(v.parentId)?v.parentId:M;for(let W of[...w,...k])f(W);let _=Fk(v.type,v.id),z=a.get($)??[],j=v.siblingIndex??A??z.length,G=Math.min(Math.max(0,j),z.length);z.splice(G,0,_.group),a.set($,z),a.set(_.group,[_.path,_.content]),a.set(_.path,[...w]),a.set(_.content,[...k]),b.set(_.group,{id:_.group,parentId:$,index:0}),b.set(_.path,{id:_.path,parentId:_.group,index:0}),b.set(_.content,{id:_.content,parentId:_.group,index:1})}let I=[];for(let[v,w]of a)w.forEach((k,C)=>{let P=b.get(k);if(P){I.push({...P,parentId:v,index:C});return}let R=n.get(k);R&&R.parentId===v?I.push({...R,index:C}):I.push({id:k,parentId:v,index:C})});e.sceneTree=I}function ir(e){let t=[],n=new Map,r=new Set,i=new WeakSet,o=[...e].reverse();for(;o.length>0;){let a=o.pop();if(!a||typeof a!="object"||i.has(a))continue;i.add(a),t.push(a);let c=n.get(a.id);c&&c!==a?r.add(a.id):c||n.set(a.id,a);let l=a.state.children;if(Array.isArray(l))for(let d=l.length-1;d>=0;d--){let u=l[d];u&&typeof u=="object"&&typeof u.id=="string"&&o.push(u)}}let s=new Map(n);for(let a of r)s.delete(a);return{ordered:t,uniqueById:s,duplicateIds:r}}function Vi(e){let t=[...e??[]],n=new Map;for(let o of t)n.set(o.id,(n.get(o.id)??0)+1);let r=new Set([...n].filter(([,o])=>o>1).map(([o])=>o)),i=new Map;for(let o of t)r.has(o.id)||i.set(o.id,o);return{ordered:t,uniqueById:i,duplicateIds:r,definition:o=>i.get(o),symbol:o=>{let s=i.get(o);return s?.kind==="symbol"?s:void 0}}}function y1(e){let t=e.groupData;if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t.transform;return typeof n=="string"&&n.trim()?n:null}function gc(e,t){let n=fn(e,t);if(n)return{matrix:ur(e,t),attribute:n,owner:"canonical"};let r=y1(e);if(r){let i=Rn(r),o=e.customPivot;return{matrix:o?Ol(o,i):i,attribute:r,owner:"group-data"}}return{matrix:Ke,attribute:null,owner:"none"}}function An(e){let t=e.transformMatrix;return xi(t)&&!un(t)||e.customPivot||typeof e.rawTransform=="string"&&e.rawTransform?!1:(e.rotation??0)!==0||(e.skewX??0)!==0||(e.skewY??0)!==0||(e.scaleX??1)!==1||(e.scaleY??1)!==1}function fu(e,t){let n=t?{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}:void 0;return gc(e,n)}var S1=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,b1=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)px$/i,v1=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)%$/;function hc(e,t,n,r){let i=e.trim();if(S1.test(i))return Number(i);let o=b1.exec(i);if(o)return Number(o[1]);let s=v1.exec(i);if(s)return t.percentBasis===void 0?(r.push({code:"unresolved-symbol-viewport",message:`Symbol ${t.axis} percentage ${e} needs a containing viewport basis.`}),null):Number(s[1])/100*t.percentBasis;let a=n.resolveLength?.(e,t)??null;return a!==null&&Number.isFinite(a)?a:(r.push({code:"invalid-symbol-length",message:`Symbol ${t.axis} length ${e} is invalid or requires an unavailable length host.`}),null)}function x1(e){let t=e.state.authoredUseGeometry;return t&&typeof t=="object"?t:{}}function xo(e,t){let n=e[t];if(typeof n=="string")return n;if(["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(t))return;let r=e.rootAttributes?.[t];return typeof r=="string"?r:void 0}function I1(e,t){if(e===void 0)return;let n=Mt(e);return n?n.width<0||n.height<0?(t.push({code:"invalid-symbol-viewbox",message:`Symbol viewBox ${e} has a non-finite or negative dimension and is ignored.`}),null):n:(t.push({code:"invalid-symbol-viewbox",message:`Symbol viewBox ${e} is not four finite SVG numbers and is ignored.`}),null)}function Bk(e,t,n,r,i,o){return t===void 0?0:hc(t,{axis:n,percentBasis:n==="x"?r?.width:r?.height},i,o)??0}function Vk(e,t,n,r,i,o,s){let a=n==="width"?i?.width:i?.height,c=[r,xo(t,n)];for(let l of c){if(l===void 0||l.trim().toLowerCase()==="auto")continue;let d=hc(l,{axis:n,percentBasis:a},o,s);if(d!==null){if(d<0){s.push({code:"invalid-symbol-length",message:`Negative symbol ${n} ${l} is invalid and falls back to auto.`});continue}return d}}return a!==void 0?a:(s.push({code:"unresolved-symbol-viewport",message:`Symbol ${n} is auto and needs a containing viewport basis.`}),null)}function Gk(e,t,n,r,i){if(e===void 0)return;let o=e.trim();if(t==="refX"){if(o==="left")return 0;if(o==="center")return(n?.width??0)/2;if(o==="right")return n?.width??0}else{if(o==="top")return 0;if(o==="center")return(n?.height??0)/2;if(o==="bottom")return n?.height??0}return hc(e,{axis:t,percentBasis:t==="refX"?n?.width:n?.height},r,i)??void 0}function yc(e,t,n,r={}){let i=[],o=x1(e),s=Bk(e,o.x,"x",n,r,i),a=Bk(e,o.y,"y",n,r,i),c=ft(s,a),l=xo(t,"transform"),d=l?Rn(l):Ke;if((t.defKind??"symbol")!=="symbol")return{kind:"group",renders:!0,useX:s,useY:a,useAttributes:o,contentMatrix:Ie(c,d),childPercentBasis:n??null,viewport:null,diagnostics:i};let u=Vk(e,t,"width",o.width,n,r,i),f=Vk(e,t,"height",o.height,n,r,i),p=xo(t,"x"),m=xo(t,"y"),g=p!==void 0?hc(p,{axis:"x",percentBasis:n?.width},r,i)??0:0,h=m!==void 0?hc(m,{axis:"y",percentBasis:n?.height},r,i)??0:0,y=I1(t.viewBox,i),S=ss({width:u,height:f,...y?{viewBoxX:y.x,viewBoxY:y.y,viewBoxWidth:y.width,viewBoxHeight:y.height}:{},preserveAspectRatio:xo(t,"preserveAspectRatio")},n);for(let C of S.diagnostics)i.push({code:C.code==="unresolved-viewport-size"?"unresolved-symbol-viewport":"invalid-symbol-viewbox",message:C.message.replace("Nested SVG","Symbol")});if(u===null||f===null||!S.renders||!S.contentMatrix)return{kind:"symbol",renders:!1,useX:s,useY:a,useAttributes:o,contentMatrix:Ie(c,d),childPercentBasis:S.childPercentBasis,viewport:S,diagnostics:i};let b=Gk(xo(t,"refX"),"refX",S.childPercentBasis,r,i),I=Gk(xo(t,"refY"),"refY",S.childPercentBasis,r,i),v=qe(S.contentMatrix,{x:b??0,y:I??0}),w=ft(g-(b===void 0?0:v.x),h-(I===void 0?0:v.y)),k=Ie(Ie(Ie(c,d),w),S.contentMatrix);return{kind:"symbol",renders:!0,useX:s,useY:a,useAttributes:o,contentMatrix:k,childPercentBasis:S.childPercentBasis,viewport:S,diagnostics:i}}function pu(){return{bounds:null,status:"empty",diagnostics:[]}}function Es(e,t,n){return n.resolveOwnTransform?.(e,t)??t}function xr(e,t){return{bounds:null,status:e,diagnostics:[t]}}function Sc(e,t){return e?t?{minX:Math.min(e.minX,t.minX),minY:Math.min(e.minY,t.minY),maxX:Math.max(e.maxX,t.maxX),maxY:Math.max(e.maxY,t.maxY)}:e:t}function vr(e,t,n="empty"){return e?{bounds:e,status:"resolved",diagnostics:t}:t.some(r=>r.code==="container-cycle"||r.code==="reference-cycle"||r.code==="symbol-cycle")?{bounds:null,status:"cycle",diagnostics:t}:t.some(r=>r.code==="unsupported-shape"||r.code==="deferred-tree-kind")?{bounds:null,status:"unsupported",diagnostics:t}:t.some(r=>r.code==="unresolved-shape"||r.code==="unresolved-reference-target"||r.code==="unresolved-reference-pivot"||r.code==="duplicate-shape-id"||r.code==="unresolved-svg-viewport"||r.code==="unresolved-symbol-definition"||r.code==="duplicate-library-id"||r.code==="unresolved-symbol-viewport"||r.code==="unresolved-symbol-pivot")?{bounds:null,status:"unresolved",diagnostics:t}:{bounds:null,status:n,diagnostics:t}}function mh(e){if(e.length===0)return null;let t=e[0].x,n=e[0].y,r=e[0].x,i=e[0].y;for(let o=1;o<e.length;o++){let s=e[o];t=Math.min(t,s.x),n=Math.min(n,s.y),r=Math.max(r,s.x),i=Math.max(i,s.y)}return{minX:t,minY:n,maxX:r,maxY:i}}function yh(e,t){return mh([qe(t,{x:e.minX,y:e.minY}),qe(t,{x:e.maxX,y:e.minY}),qe(t,{x:e.maxX,y:e.maxY}),qe(t,{x:e.minX,y:e.maxY})])}function jk(e,t,n,r,i){return n<0||r<0?null:yh({minX:e,minY:t,maxX:e+n,maxY:t+r},i)}function Uk(e,t,n,r,i){if(n<0||r<0)return null;let o=qe(i,{x:e,y:t}),s=Math.hypot(i[0]*n,i[2]*r),a=Math.hypot(i[1]*n,i[3]*r);return{minX:o.x-s,minY:o.y-a,maxX:o.x+s,maxY:o.y+a}}function w1(e,t){let n=Array.isArray(e)?e:[e],r=null;for(let i of n)r=Sc(r,yh(i,t));return r}function fh(e,t,n){return xr("unsupported",{code:t,shapeId:e.id,message:`Object bounds for ${n} require a document resolver policy.`,path:[e.id]})}function k1(e,t,n={}){return gh(e,Jn(e),t,n)}function gh(e,t,n,r){if(!t)return xr("unsupported",{code:"unsupported-shape",shapeId:e.id,message:`No geometry kernel is registered for shape type ${e.type}.`,path:[e.id]});let i;switch(t.kind){case"circle":i=Uk(t.cx,t.cy,t.r,t.r,n);break;case"ellipse":i=Uk(t.cx,t.cy,t.rx,t.ry,n);break;case"rectangle":if(t.width<0||t.height<0)i=null;else if(t.pathData)i=mr(t.pathData,n);else if(t.rx>0&&t.ry>0){let o=Dm(t.x,t.y,t.width,t.height,t.rx,t.ry);i=o?mr(o,n):null}else i=jk(t.x,t.y,t.width,t.height,n);break;case"line":if(t.boundsPolicy==="linked-line")return fh(e,"deferred-tree-kind","linked line");i=mh([qe(n,{x:t.x1,y:t.y1}),qe(n,{x:t.x2,y:t.y2})]);break;case"text":{let o=r.measureText?.(e,t)??null;if(!o)return fh(e,"deferred-tree-kind","text");i=w1(o,n);break}case"path":{if(t.boundsPolicy==="empty")return pu();let o=t.placement?Ie(n,ft(t.placement.x,t.placement.y)):n;i=Dp(t,o);break}case"polyline":{let o=t.points.length>0?t.points:[{x:0,y:0}];i=mh(o.map(s=>qe(n,s)));break}case"positioning-rect":i=jk(t.x,t.y,t.width,t.height,n);break;case"view":return pu();case"container":case"embedded-svg":case"shape-reference":case"symbol-instance":return fh(e,"deferred-tree-kind",t.kind)}return i?{bounds:i,status:"resolved",diagnostics:[]}:{bounds:null,status:"empty",diagnostics:[]}}function hh(e){let t=e.state.children;return Array.isArray(t)?t.filter(n=>!!n&&typeof n=="object"&&typeof n.id=="string"):[]}function Ur(e){let t=ir(e.shapes),n=Vi(e.library),r=e.sceneTree??[];if(r.length===0)return{roots:()=>e.shapes,shape:l=>t.uniqueById.get(l),duplicateShapeIds:()=>t.duplicateIds,libraryDefinition:l=>n.definition(l),duplicateLibraryIds:()=>n.duplicateIds,children:hh};let i=new Map,o=new Set;for(let l of r){let d=i.get(l.parentId)??[];i.set(l.parentId,[...d,l]),t.uniqueById.has(l.id)&&o.add(l.id)}let s=l=>{let d=[],u=new Set,f=p=>{for(let m of on([...i.get(p)??[]])){let g=t.uniqueById.get(m.id);if(g){d.push(g);continue}u.has(m.id)||(u.add(m.id),f(m.id),u.delete(m.id))}};return f(l),d};return{roots:()=>[...s(null),...e.shapes.filter(l=>!o.has(l.id))],shape:l=>t.uniqueById.get(l),duplicateShapeIds:()=>t.duplicateIds,libraryDefinition:l=>n.definition(l),duplicateLibraryIds:()=>n.duplicateIds,children:l=>[...s(l.id),...hh(l).filter(d=>!o.has(d.id))]}}function Hk(e,t){return`${t.identityPrefixes.at(-1)??"document"}\0${e.id}`}var P1=new Set(["block","contents","flex","flow","flow-root","grid","inherit","initial","inline","inline-block","inline-flex","inline-grid","inline-table","list-item","none","revert","revert-layer","ruby","ruby-base","ruby-base-container","ruby-text","ruby-text-container","run-in","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","unset"]),ph=new Set(["block","inline","run-in"]),T1=new Set(["flow","flow-root","table","flex","grid","ruby"]);function R1(e){let t=e.trim().toLowerCase();if(P1.has(t)||/^(?:var|env)\(/.test(t)&&t.endsWith(")"))return!0;let n=t.split(/\s+/);if(n.length<2||n.length>3||new Set(n).size!==n.length)return!1;if(n.includes("list-item")){let r=n.filter(i=>i!=="list-item");return r.filter(i=>ph.has(i)).length<=1&&r.filter(i=>i==="flow"||i==="flow-root").length<=1&&r.every(i=>ph.has(i)||i==="flow"||i==="flow-root")}return n.length===2&&n.some(r=>ph.has(r))&&n.some(r=>T1.has(r))}function C1(e){if(!e)return null;let t=null;for(let n of Dr(e,";")){let r=Dr(n,":");if(r.length<2||r[0].trim().toLowerCase()!=="display")continue;let i=r.slice(1).join(":").trim(),o=/\s*!important\s*$/i.test(i),s=i.replace(/\s*!important\s*$/i,"").trim().toLowerCase();R1(s)&&(!t||o||!t.important)&&(t={value:s,important:o})}return t}function Kk(e,t){let n=C1(typeof t=="string"?t:void 0);return n?n.value!=="none":typeof e!="string"||e.trim().toLowerCase()!=="none"}function bc(e,t){if(e.state.visible===!1)return!1;let n=e.type==="symbol-instance"||e.type==="shape-reference"?e.state.instancePresentation:void 0,r=n?.display??e.state.display;return Kk(r,n?.style)?t.participatesInRendering?.(e)??!0:!1}function Wk(e,t,n){let r=e.rootAttributes;return Kk(r?.display,r?.style)?n.participatesSymbolDefinition?.(e,t)??!0:!1}function A1(e,t={}){return{x:e.x,y:e.y,width:t.width!==void 0?t.width:e.width,height:t.height!==void 0?t.height:e.height,viewBoxX:e.viewBoxX,viewBoxY:e.viewBoxY,viewBoxWidth:e.viewBoxWidth,viewBoxHeight:e.viewBoxHeight,preserveAspectRatio:e.preserveAspectRatio}}function wo(e,t,n={}){let r=Jn(e);if(!r||r.kind!=="embedded-svg")return{matrix:Ke,attribute:null,pivotRequired:!1,pivotResolved:!1,viewport:ss({})};let i=ss(A1(r,n),t),o=An(e.state),s=i.frame?{x:i.frame.x+i.frame.width/2,y:i.frame.y+i.frame.height/2}:void 0;return{matrix:ur(e.state,s),attribute:fn(e.state,s),pivotRequired:o,pivotResolved:!o||s!==void 0,viewport:i}}function Xk(e,t,n){return t.diagnostics.map(r=>({code:r.code==="unresolved-viewport-size"?"unresolved-svg-viewport":"invalid-svg-viewport",shapeId:e.id,message:r.message,path:[...n,e.id]}))}function mu(e,t,n,r){let i=null,o=[],s=n.forceInlineChildren>0?hh(e):n.view.children(e);for(let a of s){if(!bc(a,n.host))continue;let c=vc(a,t,n,r);i=Sc(i,c.bounds),o.push(...c.diagnostics)}return vr(i,o)}function Yk(e,t){return{...e,diagnostics:e.diagnostics.map(n=>n.path.includes(t)?n:{...n,path:[t,...n.path]})}}function N1(e,t,n,r,i={}){let o=wo(e,r,i),s=Xk(e,o.viewport,n.path);if(o.pivotRequired&&!o.pivotResolved)return s.push({code:"unresolved-svg-viewport",shapeId:e.id,message:`Embedded SVG ${e.id} has decomposed rotation/scale/skew channels, but its auto viewport frame cannot be resolved without a parent viewport.`,path:[...n.path,e.id]}),vr(null,s,"unresolved");if(!o.viewport.renders)return vr(null,s,o.viewport.status==="zero-disabled"?"empty":"unresolved");let a=Hk(e,n);n.active.add(a),n.path.push(e.id);let l=e.state.isRootSvg===!0?t:Ie(Ie(t,Es(e,o.matrix,n.host)),o.viewport.contentMatrix??Ke),d=mu(e,l,n,o.viewport.childPercentBasis??r);return n.path.pop(),n.active.delete(a),vr(d.bounds,[...s,...d.diagnostics],d.status)}function E1(e,t,n={},r={}){let i=typeof t=="string"?e.shape(t):t;if(!i){let d=typeof t=="string"?t:t.id;return xr("unresolved",{code:"unresolved-shape",shapeId:d,message:`Shape ${d} is not present in the document bounds view.`,path:[d]})}let o=Jn(i);if(!o||o.kind!=="embedded-svg")return xr("unsupported",{code:"unsupported-shape",shapeId:i.id,message:`Shape ${i.id} is not an embedded SVG viewport.`,path:[i.id]});let s=wo(i,n.parentViewport),a=Xk(i,s.viewport,[]);if(!s.viewport.frame||s.pivotRequired&&!s.pivotResolved)return vr(null,a,"unresolved");let c=Ie(n.toTarget??Ke,Es(i,s.matrix,r)),l=s.viewport.frame;return{bounds:yh({minX:l.x,minY:l.y,maxX:l.x+l.width,maxY:l.y+l.height},c),status:"resolved",diagnostics:a}}function qk(e,t,n){let r=n.view.duplicateShapeIds?.().has(t)??!1;return xr("unresolved",{code:r?"duplicate-shape-id":"unresolved-reference-target",shapeId:e.id,message:r?`Shape reference ${e.id} targets ambiguous duplicate id ${t}.`:t?`Shape reference ${e.id} targets ${t}, which is not present in the document.`:`Shape reference ${e.id} has no targetShapeId.`,path:t?[...n.path,t]:[...n.path]})}function O1(e,t){let n=[...t.path,e.id];return xr("cycle",{code:"reference-cycle",shapeId:e.id,message:`Shape reference cycle detected: ${n.join(" -> ")}.`,path:n})}function Zk(e,t,n,r,i){if(!An(e.state))return{matrix:ur(e.state),attribute:fn(e.state),pivotRequired:!1,pivotResolved:!0,diagnostics:[],contentBounds:null};let s=ft(t.offsetX,t.offsetY),a={width:t.width,height:t.height},c=Yk(vc(n,s,r,i,a),e.id),l=c.diagnostics.some(u=>u.code==="unsupported-shape"||u.code==="deferred-tree-kind"||u.code==="unresolved-reference-pivot"),d=c.bounds&&!l?{x:(c.bounds.minX+c.bounds.maxX)/2,y:(c.bounds.minY+c.bounds.maxY)/2}:null;if(!d){let u=c.bounds===null&&(c.status==="empty"||c.status==="cycle"||c.status==="unresolved"),f={code:"unresolved-reference-pivot",shapeId:e.id,message:`Shape reference ${e.id} has decomposed rotation/scale/skew channels, but its translated target bounds require unavailable contextual geometry or measurement.`,path:[...r.path]};return{matrix:ur(e.state),attribute:fn(e.state),pivotRequired:!0,pivotResolved:u,diagnostics:u?c.diagnostics:[...c.diagnostics,f],contentBounds:c}}return{matrix:ur(e.state,d),attribute:fn(e.state,d),pivotRequired:!0,pivotResolved:!0,diagnostics:[],contentBounds:c}}function D1(e,t,n,r,i){if(r.activeReferences.has(e.id))return O1(e,r);r.activeReferences.add(e.id),r.path.push(e.id);let o=u=>(r.path.pop(),r.activeReferences.delete(e.id),u),s=t.targetShapeId?.trim()??"",a=s?r.view.shape(s):void 0;if(!a)return o(qk(e,s,r));if(!bc(a,r.host))return o(pu());let c=Zk(e,t,a,r,i);if(c.pivotRequired&&!c.pivotResolved)return o(vr(null,[...c.diagnostics],"unresolved"));if(c.contentBounds?.bounds===null&&c.pivotResolved)return o(c.contentBounds);let l=Ie(Ie(n,Es(e,c.matrix,r.host)),ft(t.offsetX,t.offsetY)),d=Yk(vc(a,l,r,i,{width:t.width,height:t.height}),e.id);return o({...d,diagnostics:[...c.diagnostics,...d.diagnostics]})}function Ns(e,t){let n=e.state.instancePresentation?.transform,r=typeof n=="string"&&n.trim()?n.trim():null,i=ur(e.state,t),o=fn(e.state,t);return r?{matrix:Ie(Rn(r),i),attribute:o?`${r} ${o}`:r}:{matrix:i,attribute:o}}function Io(e,t,n,r){return{code:n,shapeId:e.id,message:r,path:[...t.path,e.id]}}function Qk(e,t,n,r,i,o){let s=null,a=[];for(let c of n){if(!bc(c,i.host))continue;let l=vc(c,r,i,o);s=Sc(s,l.bounds),a.push(...l.diagnostics)}for(let c of t.definitionContentOrder??[]){if(c.kind!=="definition")continue;let l=i.view.libraryDefinition?.(c.id);if(!l||l.kind!=="symbol"){a.push(Io(e,i,"unresolved-symbol-definition",`Nested definition ${c.id} is missing from ${t.id}.`));continue}if((l.defKind??"symbol")==="symbol"||!Wk(l,e,i.host))continue;let d=`definition-forest\0${l.id}`;if(i.activeSymbols.has(d)){a.push(Io(e,i,"symbol-cycle",`Nested definition forest cycle detected through ${l.id}.`));continue}i.activeSymbols.add(d),i.path.push(l.id);let u=l.rootAttributes?.transform,f=u?Ie(r,Rn(u)):r,p=Qk(e,l,l.shapes,f,i,o);i.path.pop(),i.activeSymbols.delete(d),s=Sc(s,p.bounds),a.push(...p.diagnostics)}return vr(s,a)}function Jk(e,t,n,r,i,o=!1){let s=Zo(t,e),a=yc(e,t,i,{resolveLength:r.host.resolveSymbolLength}),c=[...s.diagnostics.map(g=>Io(e,r,g.code,g.message)),...a.diagnostics.map(g=>Io(e,r,g.code==="invalid-symbol-length"||g.code==="invalid-symbol-viewbox"?"invalid-symbol-viewport":"unresolved-symbol-viewport",g.message))];if(!a.renders){let g=a.viewport?.status==="zero-disabled";return{...vr(null,c,g?"empty":"unresolved"),transform:{...Ns(e),pivotRequired:An(e.state),pivotResolved:!0,diagnostics:c}}}if(!Wk(t,e,r.host))return{...pu(),transform:{...Ns(e),pivotRequired:An(e.state),pivotResolved:!0,diagnostics:c}};if(r.activeSymbols.has(s.materializationKey)){let g=Io(e,r,"symbol-cycle",`Symbol instance cycle detected through ${t.id}.`);return{...xr("cycle",g),transform:{...Ns(e),pivotRequired:An(e.state),pivotResolved:!0,diagnostics:[g]}}}r.activeSymbols.add(s.materializationKey),r.identityPrefixes.push(s.materializationKey),r.forceInlineChildren++,r.path.push(e.id);let l=g=>Qk(e,t,s.shapes,g,r,a.childPercentBasis??i),d=An(e.state),u=Ns(e),f=!d,p=[];if(d){let g=l(a.contentMatrix),h=g.diagnostics.some(S=>S.code==="unsupported-shape"||S.code==="deferred-tree-kind"||S.code==="unresolved-symbol-viewport"),y=g.bounds&&!h?{x:(g.bounds.minX+g.bounds.maxX)/2,y:(g.bounds.minY+g.bounds.maxY)/2}:void 0;if(y)u=Ns(e,y),f=!0;else{let S=g.bounds===null&&(g.status==="empty"||g.status==="cycle"||g.status==="unresolved");f=S,S||(p=[Io(e,r,"unresolved-symbol-pivot",`Symbol instance ${e.id} needs unavailable contextual geometry or measurement for its decomposed transform pivot.`)]),S&&!o&&(p=[...g.diagnostics])}}let m;if(d&&!f)m=vr(null,[...c,...p],"unresolved");else{let g=Ie(Ie(n,Es(e,u.matrix,r.host)),a.contentMatrix),h=l(g);m=vr(h.bounds,[...c,...p,...h.diagnostics],h.status)}return r.path.pop(),r.forceInlineChildren--,r.identityPrefixes.pop(),r.activeSymbols.delete(s.materializationKey),{...m,transform:{...u,pivotRequired:d,pivotResolved:f,diagnostics:[...c,...p]}}}function $1(e,t,n,r){let i=String(e.state.symbolId??"").trim(),o=i?n.view.duplicateLibraryIds?.().has(i)??!1:!1,s=i?n.view.libraryDefinition?.(i):void 0;if(o||!s||s.kind!=="symbol")return xr("unresolved",Io(e,n,o?"duplicate-library-id":"unresolved-symbol-definition",o?`Symbol instance ${e.id} targets duplicate library id ${i}.`:`Symbol instance ${e.id} targets missing symbol definition ${i||"(blank)"}.`));let a=Jk(e,s,t,n,r),{transform:c,...l}=a;return l}function vc(e,t,n,r,i={}){let o=Hk(e,n);if(n.active.has(o)){if(!n.collectDiagnostics)return{bounds:null,status:"cycle",diagnostics:[]};let l=[...n.path,e.id];return xr("cycle",{code:"container-cycle",shapeId:e.id,message:`Container cycle detected: ${l.join(" -> ")}.`,path:l})}let s=Jn(e);if(!s)return gh(e,s,t,n.host);if(s.kind==="shape-reference")return D1(e,s,t,n,r);if(s.kind==="embedded-svg")return N1(e,t,n,r,i);if(s.kind==="symbol-instance")return $1(e,t,n,r);if(s.kind!=="container"){let l=ur(e.state,s.defaultPivot??void 0);return gh(e,s,Ie(t,Es(e,l,n.host)),n.host)}n.active.add(o),n.path.push(e.id);let a=gc(e.state).matrix;if(An(e.state)){let l=n.collectDiagnostics;n.collectDiagnostics=!1;let d=mu(e,Ke,n,r);n.collectDiagnostics=l;let u=d.diagnostics.some(f=>f.code==="unsupported-shape"||f.code==="deferred-tree-kind");a=fu(e.state,u?null:d.bounds).matrix}let c=mu(e,Ie(t,Es(e,a,n.host)),n,r);return n.path.pop(),n.active.delete(o),c}function fi(e,t,n={},r={}){let i=typeof t=="string"?e.shape(t):t;if(!i){let o=typeof t=="string"?t:t.id;return xr("unresolved",{code:"unresolved-shape",shapeId:o,message:`Shape ${o} is not present in the document bounds view.`,path:[o]})}return vc(i,n.toTarget??Ke,{view:e,host:r,active:new Set,activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[],collectDiagnostics:!0},n.parentViewport)}function xc(e,t,n={},r={}){let i=typeof t=="string"?e.shape(t):t;if(!i){let s=typeof t=="string"?t:t.id;return xr("unresolved",{code:"unresolved-shape",shapeId:s,message:`Shape ${s} is not present in the document bounds view.`,path:[s]})}let o={...r,resolveOwnTransform:(s,a)=>s===i?Ke:r.resolveOwnTransform?.(s,a)??a};return fi(e,i,{parentViewport:n.parentViewport},o)}function Sh(e,t,n={},r){let i=Jn(t);if(!i||i.kind!=="shape-reference")return{matrix:Ke,attribute:null,pivotRequired:!1,pivotResolved:!1,diagnostics:[]};let o={view:e,host:n,active:new Set,activeReferences:new Set([t.id]),activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[t.id],collectDiagnostics:!0},s=i.targetShapeId?.trim()??"",a=s?e.shape(s):void 0;if(!a||!bc(a,n)){let l=An(t.state);return{matrix:ur(t.state),attribute:fn(t.state),pivotRequired:l,pivotResolved:!0,diagnostics:a?[]:qk(t,s,o).diagnostics}}let c=Zk(t,i,a,o,r);return{matrix:c.matrix,attribute:c.attribute,pivotRequired:c.pivotRequired,pivotResolved:c.pivotResolved,diagnostics:c.diagnostics}}function bh(e,t,n={},r){let i=An(t.state),o=String(t.state.symbolId??"").trim(),s=o?e.duplicateLibraryIds?.().has(o)??!1:!1,a=o?e.libraryDefinition?.(o):void 0;return s||!a||a.kind!=="symbol"?{...Ns(t),pivotRequired:i,pivotResolved:!0,diagnostics:[]}:Jk(t,a,Ke,{view:e,host:n,active:new Set,activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[],collectDiagnostics:!0},r,!0).transform}function M1(e,t={},n={}){let r=null,i=[];for(let o of e.roots()){if(!bc(o,n))continue;let s=fi(e,o,t,n);r=Sc(r,s.bounds),i.push(...s.diagnostics)}return vr(r,i)}function vh(e,t={}){if(!An(e.state))return{transform:gc(e.state),contentBounds:null,pivotRequired:!1,pivotResolved:!0};let i={view:Ur({shapes:[e],viewboxes:[]}),host:t,active:new Set([`document\0${e.id}`]),activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[e.id],collectDiagnostics:!0},o=mu(e,Ke,i),a=o.diagnostics.some(c=>c.code==="unsupported-shape"||c.code==="deferred-tree-kind")?null:o.bounds;return{transform:fu(e.state,a),contentBounds:o,pivotRequired:!0,pivotResolved:a!==null||o.status==="empty"}}function Ic(e,t=e.id){return{kind:"pattern",id:t,name:e.name??t,pattern:{type:"pattern",svgContent:e.svgContent,width:e.width,height:e.height,patternType:"custom",color:"#000000",backgroundColor:"transparent",scale:1,rotation:0,opacity:1,patternUnits:"userSpaceOnUse"}}}function xh(e){if(e.builtIn)return!1;let t=e.pattern;return!t||typeof t!="object"?!1:t.patternType==="custom"&&typeof t.svgContent=="string"}var z1=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:px)?$/u;function e0(e,t){if(e.patternUnits!=="userSpaceOnUse")return;let n=e.authoredGeometry?.[t]?.trim();if(n===void 0||!z1.test(n))return;let r=Number.parseFloat(n);return Number.isFinite(r)&&r>0?r:void 0}function Ih(e){let t=(e.viewBox??"").trim().split(/[\s,]+/).filter(o=>o.length>0).map(Number),n=t.length===4&&t.every(o=>Number.isFinite(o)),r=n&&t[2]>0?t[2]:e.width??e0(e,"width")??10,i=n&&t[3]>0?t[3]:e.height??e0(e,"height")??10;return{width:r,height:i}}function wh(e){if(!xh(e))return null;let{width:t,height:n}=Ih(e.pattern);return{id:e.id,name:e.name,svgContent:e.pattern.svgContent??"",width:t,height:n}}function F1(e,t){let n=new Map(t.map(o=>[o.id,o])),r=typeof e=="string"?n.get(e):e,i=new Set;for(;r?.kind==="pattern";){if(i.has(r.id))return null;if(i.add(r.id),xh(r))return r;let o=r.pattern?.templateId;if(!o)return null;r=n.get(o)}return null}function L1(e,t){let n=F1(e,t);if(!n)return null;let{width:r,height:i}=Ih($w(n,t)??n.pattern);return{id:n.id,name:n.name,svgContent:n.pattern.svgContent??"",width:r,height:i}}function _1(){let e=new Set(jb);for(let t of Ub)e.add(t);for(let t of Te.typeIds())for(let n of Object.keys(Te.getDefaults(t)))e.add(n);return e.delete("scaleAnchor"),e.delete("extra"),e}var t0=_1(),B1=new Set(["scaleAnchor","displayAttr"]);function gu(e){let t=e.extra&&typeof e.extra=="object"&&!Array.isArray(e.extra)?e.extra:void 0;for(let n of Object.keys(e)){if(n==="extra"||t0.has(n))continue;let r=e[n];delete e[n],r!==void 0&&((t??={})[n]=r)}return t&&Object.keys(t).length>0?e.extra=t:delete e.extra,e}function kh(e){return In(e,{onState:t=>{gu(t)}}),e}function Ph(e){return In(e,{onState:t=>{ko(t)}}),e}function ko(e){let t=e.extra;if(!t||typeof t!="object"||Array.isArray(t))return delete e.extra,e;for(let[n,r]of Object.entries(t))n!=="extra"&&(n in e||(e[n]=r));return delete e.extra,e}function Th(e){return typeof e=="string"&&e.length>0?e:null}function V1(e){let t=Th(e.groupId);if(t)return t;let n=e.extra;return!n||typeof n!="object"||Array.isArray(n)?null:Th(n.groupId)}function n0(e){delete e.groupId;let t=e.extra;if(!t||typeof t!="object"||Array.isArray(t))return;let n=t;delete n.groupId,Object.keys(n).length===0&&delete e.extra}function G1(e){let t={};return e.transformOrigin&&(t.transformOrigin=e.transformOrigin),e.pluginId&&(t.pluginId=e.pluginId),e.pluginData&&(t.pluginData=e.pluginData),e.attributes&&Object.keys(e.attributes).length>0&&(t.attributes=e.attributes),e.fill&&(t.fill=e.fill),e.fillOpacity&&(t.fillOpacity=e.fillOpacity),e.strokeOpacity&&(t.strokeOpacity=e.strokeOpacity),e.opacity&&(t.opacity=e.opacity),e.filter&&(t.filter=e.filter),e.cssFilter&&(t.cssFilter=e.cssFilter),e.mixBlendMode&&(t.mixBlendMode=e.mixBlendMode),e.isolation&&(t.isolation=e.isolation),e.clipPath&&(t.clipPath=e.clipPath),e.mask&&(t.mask=e.mask),e.rawMetadata&&(t.rawMetadata=e.rawMetadata),e.transform&&(t.transform=e.transform),t}function j1(e){let t=G1(e),n={fillColor:null,borderColor:null,rotation:0,skewX:0,skewY:0,customPivot:null};return Object.keys(t).length>0&&(n.groupData=t),{id:e.id,type:"group",state:n}}function r0(e,t){let n=e.state.children;if(Array.isArray(n))for(let r of n)t.add(r.id),r0(r,t)}function i0(e,t=!1){let n=e.state,r=n.children;return t&&n0(n),Array.isArray(r)&&(n.children=r.map(i=>i0(i,!0))),e}function U1(e){if(e.length<2)return e.map(s=>s.shape);let t=e.filter(s=>s.shape.type==="group"&&s.siblingIndex!==void 0&&Number.isFinite(s.siblingIndex)).sort((s,a)=>(s.siblingIndex??0)-(a.siblingIndex??0));if(t.length===0)return[...e].sort((s,a)=>s.flatOrder-a.flatOrder).map(s=>s.shape);let n=Array(e.length).fill(null),r=new Set(t);for(let s of t){let a=Math.max(0,Math.min(e.length-1,s.siblingIndex??0));for(;a<n.length&&n[a]!==null;)a++;if(a>=n.length)for(a=n.length-1;a>=0&&n[a]!==null;)a--;a>=0&&(n[a]=s)}let i=e.filter(s=>!r.has(s)).sort((s,a)=>s.flatOrder-a.flatOrder),o=0;for(let s of i){for(;o<n.length&&n[o]!==null;)o++;o<n.length&&(n[o]=s)}return n.filter(s=>s!==null).map(s=>s.shape)}function wc(e,t=[]){let n=structuredClone(e),r=structuredClone(t),i=new Map;for(let h of r)i.set(h.id,h);let o=n.map(h=>i0(h)),s=new Set;for(let h of o)r0(h,s);let a=new Map,c=new Map;o.forEach((h,y)=>{s.has(h.id)||c.has(h.id)||(a.set(h.id,y),c.set(h.id,h))});for(let h of r){if(s.has(h.id)||c.has(h.id))continue;let y=j1(h);a.set(y.id,Number.POSITIVE_INFINITY),c.set(y.id,y)}let l=new Map,d=new Map;for(let h of c.values()){let y=h.state,S=i.get(h.id),b=V1(y)??(h.type==="group"?Th(S?.parentId):null),I=l.get(b)??[];d.set(h.id,b),I.push({shape:h,flatOrder:a.get(h.id)??Number.POSITIVE_INFINITY,siblingIndex:h.type==="group"?S?.siblingIndex:void 0}),l.set(b,I)}let u=new Set,f=h=>{if(u.has(h.id))return null;u.add(h.id);let y=h.state,S=Array.isArray(y.children)?y.children:[],b=p(h.id),I=new Set(S.map(w=>w.id)),v=[...S,...b.filter(w=>!I.has(w.id))];return v.length>0?y.children=v:delete y.children,n0(y),h},p=h=>{let y=[];for(let S of U1(l.get(h)??[])){let b=f(S);b&&y.push(b)}return y},m=p(null),g=h=>{if(!h)return;let y=f(h);y&&m.push(y)};for(let h of c.values()){let y=d.get(h.id);y&&!c.has(y)&&g(h)}for(let h of r)g(c.get(h.id));for(let h of c.values())g(h);return m}var hu="data-svgsketch-passthrough",H1=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]),K1=/^<([A-Za-z][\w:-]*)\b[^>]*>/;function o0(e){return K1.exec(e.trimStart())}function yu(e){let t=o0(e);if(!t)return null;let n=/\bid\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(t[0]);return n?n[1]??n[2]:null}function W1(e){let t=o0(e);if(!t)return null;let n=t[1],r=n.lastIndexOf(":");return r>=0?n.slice(r+1):n}var X1=new RegExp(`\\s+${hu}\\s*=\\s*(?:"[^"]*"|'[^']*')`);function Su(e){let t=e.markup.indexOf(">");if(t<0)return e;let n=e.markup.slice(0,t+1),r=X1.exec(n);if(!r)return e;let i=n.slice(0,r.index)+n.slice(r.index+r[0].length);return{...e,markup:i+e.markup.slice(t+1),passthrough:!0}}function s0(e){let t=[];for(let n of e){if(typeof n!="string")continue;let r=yu(n);if(!r)continue;let i=W1(n),o=i&&H1.has(i)?i:"mask";t.push(Su({id:r,type:o,markup:n}))}return t}var Y1=[["splinePoints","pathPoints"],["splineClosed","pathClosed"],["splineCurveType","pathCurveType"],["splineTension","pathTension"],["splineArcParams","pathArcParams"],["splineControlBounds","pathControlBounds"]];function q1(e){let t=!1;if(e.type==="spline"&&(e.type="path",t=!0),e.state&&typeof e.state=="object"){let n=e.state,r=n.extra&&typeof n.extra=="object"&&!Array.isArray(n.extra)?n.extra:null;for(let[i,o]of Y1)Object.prototype.hasOwnProperty.call(n,i)&&(Object.prototype.hasOwnProperty.call(n,o)||(n[o]=n[i]),Reflect.deleteProperty(n,i),t=!0),r&&Object.prototype.hasOwnProperty.call(r,i)&&(Object.prototype.hasOwnProperty.call(n,o)||(n[o]=r[i]),delete r[i],t=!0);r&&Object.keys(r).length===0&&delete n.extra}return t}function a0(e){return ht(e,{onShape:t=>{q1(t)}}),e}function Z1(e){if(e.type!=="connector")return;let t=e.state,n=kc(t.sourcePoint),r=kc(t.targetPoint);e.type="line",e.state={...e.state,x1:typeof t.x1=="number"?t.x1:n?.x??0,y1:typeof t.y1=="number"?t.y1:n?.y??0,x2:typeof t.x2=="number"?t.x2:r?.x??0,y2:typeof t.y2=="number"?t.y2:r?.y??0,routingMode:t.routingMode??"orthogonal"}}function u0(e){let t=e.customPivot;if(t)return t;let n=e.x,r=e.y,i=e.width,o=e.height;if(typeof n=="number"&&typeof r=="number"&&typeof i=="number"&&typeof o=="number")return{x:n+i/2,y:r+o/2};let s=e.radius;if(typeof n=="number"&&typeof r=="number"&&typeof s=="number")return{x:n,y:r};let a=e.cx,c=e.cy;if(typeof a=="number"&&typeof c=="number")return{x:a,y:c};let l=e.x1,d=e.y1,u=e.x2,f=e.y2;if(typeof l=="number"&&typeof d=="number"&&typeof u=="number"&&typeof f=="number")return{x:(l+u)/2,y:(d+f)/2};let p=e.pathPoints;if(p?.[0])return{x:p[0].x,y:p[0].y};let m=e.polylinePoints;if(m?.[0])return{x:m[0].x,y:m[0].y}}function Q1(e){return ht(e,{onShape:t=>{let n=t.state;!n||typeof n!="object"||_v(n,u0(n))}}),e.schemaVersion=3,e}function kc(e){let t=e;return t&&typeof t.x=="number"&&Number.isFinite(t.x)&&typeof t.y=="number"&&Number.isFinite(t.y)?{x:t.x,y:t.y}:null}function J1(e,t){let n=e.translateX??0,r=e.translateY??0,i=typeof e.rawTransform=="string"?e.rawTransform:"",o=ft(n,r);if(i)return Ct(Ie(o,Rn(i)));let s=e.rotation??0,a=e.skewX??0,c=e.skewY??0;if(s!==0||a!==0||c!==0){let u=kc(e.customPivot)??t??kc(e.scaleAnchor);u&&(o=Ie(o,ft(u.x,u.y)),s!==0&&(o=Ie(o,Pa(s))),a!==0&&(o=Ie(o,Nl(a))),c!==0&&(o=Ie(o,El(c))),o=Ie(o,ft(-u.x,-u.y)))}let l=e.scaleX??1,d=e.scaleY??1;if(l!==1||d!==1){let u=kc(e.scaleAnchor)??t;u&&(o=Ie(o,ft(u.x,u.y)),o=Ie(o,Wo(l,d)),o=Ie(o,ft(-u.x,-u.y)))}return Ct(o)}function eB(e){return ht(e,{onShape:t=>{let n=t.state;!n||typeof n!="object"||!("scaleAnchor"in n)||(t.type==="text"&&!xi(n.transformMatrix)&&(n.transformMatrix=J1(n,u0(n))),delete n.scaleAnchor)}}),e.schemaVersion=4,e}function tB(e){let t=e,n=Array.isArray(e.library)?[...e.library]:[],r=new Set(n.map(l=>l.id));if(Array.isArray(t.symbols))for(let l of t.symbols)!l||r.has(l.id)||(n.push({...l,kind:"symbol"}),r.add(l.id));if(Array.isArray(t.markers))for(let l of t.markers)!l||r.has(l.id)||(n.push({...l,kind:"marker"}),r.add(l.id));let i=new Map,o=(l,d)=>{let{id:u,sourceId:f,...p}=l,m=JSON.stringify({kind:d,...p}),g=i.get(m);if(g)return g;let h=r.has(l.id)?`grd-${bu()}`:l.id;r.add(h),i.set(m,h);let y=d==="linear-gradient"?{kind:"linear-gradient",id:h,name:l.sourceId??h,sourceId:l.sourceId,gradient:c0(l)}:{kind:"radial-gradient",id:h,name:l.sourceId??h,sourceId:l.sourceId,gradient:c0(l)};return n.push(y),h},s=new Map;if(Array.isArray(t.customPatterns))for(let l of t.customPatterns){if(!l)continue;let d=r.has(l.id)?`pat-${bu()}`:l.id;r.add(d),s.set(l.id,d),n.push(Ic(l,d))}let a=l=>{if(l.customPatternId){let S=s.get(l.customPatternId);if(S)return S}let{id:d,sourceId:u,customPatternId:f,...p}=l,m=JSON.stringify({kind:"pattern",...p}),g=i.get(m);if(g)return g;let h=r.has(l.id)?`pat-${bu()}`:l.id;r.add(h),i.set(m,h);let y={kind:"pattern",id:h,name:l.sourceId??h,sourceId:l.sourceId,pattern:p};return n.push(y),h};for(let l of e.shapes??[]){let d=l.state;if(!d)continue;let u=d.fillGradient;u&&(typeof d.fillType!="string"&&(d.fillType=u.type),u.type==="linear-gradient"||u.type==="radial-gradient"?d.fillLibraryId=o(u,u.type):u.type==="pattern"&&(d.fillLibraryId=a(u)));let f=d.strokeGradient;f&&(typeof d.strokeType!="string"&&(d.strokeType=f.type),f.type==="linear-gradient"||f.type==="radial-gradient"?d.strokeLibraryId=o(f,f.type):f.type==="pattern"&&(d.strokeLibraryId=a(f)));let p=d.filters;if(Array.isArray(p)&&p.length>0){let m=c(p,d,l.id);d.filterLibraryIds=[m]}}return e.library=n,ht(e,{onShape:Z1}),delete t.customPatterns,delete t.symbols,delete t.markers,e;function c(l,d,u){let f={filters:l,colorInterpolation:d.filterColorInterpolation,filterUnits:d.filterUnits,primitiveUnits:d.primitiveUnits,x:d.filterX,y:d.filterY,width:d.filterWidth,height:d.filterHeight},p=JSON.stringify({kind:"filter",...f}),m=i.get(p);if(m)return m;let g=`filter-${u}`,h=r.has(g)?`flt-${bu()}`:g;r.add(h),i.set(p,h);let y={kind:"filter",id:h,name:h,filters:f.filters,...f.colorInterpolation?{colorInterpolation:f.colorInterpolation}:{},...f.filterUnits?{filterUnits:f.filterUnits}:{},...f.primitiveUnits?{primitiveUnits:f.primitiveUnits}:{},...f.x!==void 0?{x:f.x}:{},...f.y!==void 0?{y:f.y}:{},...f.width!==void 0?{width:f.width}:{},...f.height!==void 0?{height:f.height}:{}};return n.push(y),h}}function c0(e){let{id:t,sourceId:n,...r}=e;return r}var Rh=0;function bu(){return Rh=Rh+1&65535,`${Date.now().toString(36)}-${Rh.toString(36)}`}function nB(e){return ht(e,{onState:t=>{let n=t,r=Object.prototype.hasOwnProperty.call(n,"richTextData"),i=n.richTextData;if(gu(t),!r)return;n.richTextData=i;let o=t.extra;o&&(delete o.richTextData,Object.keys(o).length===0&&delete t.extra)}}),e.schemaVersion=5,e}function rB(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;if(t.richTextRuns!==void 0&&t.richTextRuns!==null)return;let n=t.richTextData;!n||typeof n!="object"||Array.isArray(n)||Array.isArray(n.lines)&&(t.richTextRuns=Ei(n))}function iB(e){return ht(e,{onState:t=>rB(t)}),e.schemaVersion=6,e}function Ch(e,t){if(!t.has(e))return e;let n=2;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function Pc(e){let t=new Set,n=new Set,r=new Map;ht(e,{onShape:o=>{if(n.add(o.id),o.type!=="view")return;r.has(o.id)||r.set(o.id,o);let s=o.state.viewName;typeof s=="string"&&s&&t.add(s)}});let i=[];return(e.viewboxes??[]).filter(o=>{let s=r.get(o.id);return!(s&&s.state.viewBoxX===o.x&&s.state.viewBoxY===o.y&&s.state.viewBoxWidth===Math.max(1,o.width)&&s.state.viewBoxHeight===Math.max(1,o.height))}).forEach((o,s)=>{let a=Ch(`view-${s+1}`,t);t.add(a);let c=Ch(o.id||`legacy-view-${s+1}`,n);n.add(c),i.push({id:c,type:"view",state:{viewBoxX:o.x,viewBoxY:o.y,viewBoxWidth:Math.max(1,o.width),viewBoxHeight:Math.max(1,o.height),viewName:a}})}),i.length>0&&e.shapes.unshift(...i),e.viewboxes=[],e}var oB=["svgX","svgY","svgWidth","svgHeight","svgViewBoxX","svgViewBoxY","svgViewBoxWidth","svgViewBoxHeight","svgPreserveAspectRatio"];function sB(e){if(e.type!=="svg"||e.state.isRootSvg===!0)return;let t=e.state;if(![t.svgViewBoxX,t.svgViewBoxY,t.svgViewBoxWidth,t.svgViewBoxHeight].every(i=>i===0))return;if(t.svgX===0&&t.svgY===0&&t.svgWidth===0&&t.svgHeight===0&&t.svgPreserveAspectRatio===""){for(let i of oB)delete t[i];return}delete t.svgViewBoxX,delete t.svgViewBoxY,delete t.svgViewBoxWidth,delete t.svgViewBoxHeight}function f0(e){return ht(e,{onShape:sB}),Pc(e),e.schemaVersion=7,e}var aB=["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"];function cB(e,t){if(e.type!=="symbol-instance"||e.state.authoredUseGeometry!==void 0)return;let n={};for(let r of["x","y","width","height"]){if((r==="width"||r==="height")&&t.has(String(e.state.symbolId??"")))continue;let i=e.state[r];typeof i=="number"&&Number.isFinite(i)&&(n[r]=String(i))}Object.keys(n).length>0&&(e.state.authoredUseGeometry=n)}function lB(e){let t=new Set((e.library??[]).filter(n=>n.kind==="symbol"&&n.defKind==="group").map(n=>n.id));for(let n of e.library??[]){if(n.kind!=="symbol")continue;let r=n,i={...r.wrapperAttrs??{},...r.rootAttributes??{}};for(let s of aB){let a=i[s];r[s]===void 0&&a!==void 0&&(r[s]=a),delete i[s]}if(r.overflow!==void 0&&i.overflow===void 0&&(i.overflow=r.overflow),Object.keys(i).length>0?r.rootAttributes=i:delete r.rootAttributes,r.shapes=wc(r.shapes,r.groups),r.variants)for(let[s,a]of Object.entries(r.variants))r.variants[s]=wc(a,r.groups);let o=r;delete o.wrapperAttrs,delete o.groups,delete o.overflow}return ht(e,{onShape:n=>cB(n,t)}),e.schemaVersion=8,e}function dB(e){let t=e;Array.isArray(e.shapes)&&(e.shapes=wc(e.shapes,t.groups)),delete t.groups,Array.isArray(t.rawPaintServerDefs)&&!Array.isArray(e.paintServerDefs)&&(e.paintServerDefs=s0(t.rawPaintServerDefs)),delete t.rawPaintServerDefs;for(let n of e.library??[]){if(n.kind!=="marker")continue;let r=n;r.shapes=wc(r.shapes,r.groups),delete r.groups}return Array.isArray(t.clipMaskGroups)&&(e.clipMaskGroups=t.clipMaskGroups.map(n=>{let r=n,i=Array.isArray(r.clipShapeIds)?r.clipShapeIds:typeof r.clipShapeId=="string"&&r.clipShapeId.length>0?[r.clipShapeId]:[],o={...r,clipShapeIds:i};return delete o.clipShapeId,o})),e.schemaVersion=9,e}function uB(e){return ht(e,{onState:t=>{let n=t;n.richTextRuns===void 0&&n.richTextData!==null&&typeof n.richTextData=="object"&&Array.isArray(n.richTextData.lines)&&(n.richTextRuns=Ei(n.richTextData)),delete n.richTextData}}),e.schemaVersion=10,e}function fB(e){let n=(Array.isArray(e)?e.slice(0,6).join(" "):String(e)).trim().toLowerCase();return n==="none"||n==="hidden"||n==="collapse"?"none":"inline"}function l0(e){let t=new Set(e.keyframes.flatMap(n=>n.id?[n.id]:[]));if(e.keyframes.forEach((n,r)=>{if(n.id)return;let i=`kf${r}`;for(;t.has(i);)i=`${i}x`;n.id=i,t.add(i)}),e.property==="visibility"&&e.sourceSmilAttribute==="display"){e.property="display";for(let n of e.keyframes)n.value=fB(n.value)}delete e.sourceSmilAttribute}function pB(e){if(!Array.isArray(e.shapes))return;let t=new Map,n=new Map,r=new Map,i=(s,a)=>{let c=a?n:t,l=c.get(s.id)??[];l.push(s),c.set(s.id,l),r.set(s.id,(r.get(s.id)??0)+1);let d=s.state.children;Array.isArray(d)&&d.forEach(u=>i(u,!0))};e.shapes.forEach(s=>i(s,!1));let o=new Set;for(let[s,a]of t)a.length!==1||r.get(s)!==2||(n.get(s)??[]).length===1&&o.add(s);e.shapes=e.shapes.filter(s=>!o.has(s.id))}function mB(e){if(!Array.isArray(e.shapes))return;ht(e,{onShape:a=>{if(a.type!=="view")return;let c=a.state;Reflect.deleteProperty(c,"viewLinkedSvgId"),typeof c.extra=="object"&&c.extra!==null&&!Array.isArray(c.extra)&&Reflect.deleteProperty(c.extra,"viewLinkedSvgId")}});let t=e.shapes.filter(a=>{if(a.type!=="view")return!1;let c=a.state;return c.isHomeView===!0||typeof c.extra=="object"&&c.extra!==null&&!Array.isArray(c.extra)&&c.extra.isHomeView===!0});if(t.length===0)return;let n=t[0].state,r=Number(n.viewBoxWidth??0),i=Number(n.viewBoxHeight??0),o=e.shapes.find(a=>a.type==="svg"&&a.state.isRootSvg===!0);if(o&&r>0&&i>0){let a=Number(o.state.svgViewBoxWidth??0),c=Number(o.state.svgViewBoxHeight??0);a>0&&c>0||(o.state.svgViewBoxX=Number(n.viewBoxX??0),o.state.svgViewBoxY=Number(n.viewBoxY??0),o.state.svgViewBoxWidth=r,o.state.svgViewBoxHeight=i,Number(o.state.svgWidth??0)>0||(o.state.svgWidth=r),Number(o.state.svgHeight??0)>0||(o.state.svgHeight=i))}let s=new Set(t.map(a=>a.id));e.shapes=e.shapes.filter(a=>!s.has(a.id)),e.sceneTree=e.sceneTree?.filter(a=>!s.has(a.id))}function gB(e){if(!Array.isArray(e.shapes))return;let t=new Set;ht(e,{onShape:i=>{typeof i.id=="string"&&t.add(i.id)}});let n=new Map,r=i=>i.map(o=>{let s=o.state.children;Array.isArray(s)&&(o.state.children=r(s));let a=o.state.metadata;if(!a||typeof a!="object"||Array.isArray(a))return o;let c=typeof a.linkUrl=="string"?a.linkUrl:"",l=typeof a.linkTarget=="string"?a.linkTarget:"";if(!Object.hasOwn(a,"linkUrl")&&!Object.hasOwn(a,"linkTarget"))return o;let{linkUrl:d,linkTarget:u,...f}=a;if(o.state.metadata=f,!c||o.type==="hyperlink")return o;let p=Ch(`${o.id}-link`,t);return t.add(p),n.set(o.id,p),{id:p,type:"hyperlink",state:{href:c,...l?{linkTarget:l}:{},children:[o]}}});e.shapes=r(e.shapes);for(let i of e.library??[])if(!(i.kind!=="symbol"&&i.kind!=="marker")&&(i.shapes=r(i.shapes),i.kind==="symbol"&&i.variants))for(let[o,s]of Object.entries(i.variants))i.variants[o]=r(s);if(e.sceneTree&&n.size>0){let i=[];for(let o of e.sceneTree){let s=n.get(o.id);if(!s){i.push(o);continue}i.push({...o,id:s}),i.push({id:o.id,parentId:s,index:0})}e.sceneTree=i}}function hB(e){ht(e,{onState:t=>{(t.fillType==="linear-gradient"||t.fillType==="radial-gradient"||t.fillType==="pattern")&&t.fillColor==="none"&&t.fillOpacity===0&&(t.fillOpacity=1)}})}function yB(e){ht(e,{onState:t=>{Array.isArray(t.charOffsets)&&(t.charOffsets=t.charOffsets.map(n=>{if(!n||typeof n!="object"||"dx"in n||typeof n.x!="number")return n;let r=n;return{x:null,y:null,dx:r.x,dy:typeof r.y=="number"&&Number.isFinite(r.y)?r.y:0,rotate:typeof r.rotate=="number"&&Number.isFinite(r.rotate)?r.rotate:0}}))}})}function SB(e){ht(e,{onShape:t=>{if(t.type!=="group")return;let n=t.state,r=n.groupData;if(!r||typeof r!="object"||Array.isArray(r))return;let i=r,o=i.attributes;if(o&&typeof o=="object"&&!Array.isArray(o)){let s={...o};n.locked===void 0&&s["data-locked"]==="true"&&(n.locked=!0),n.visible===void 0&&s["data-hidden"]==="true"&&(n.visible=!1),delete s["data-locked"],delete s["data-hidden"],Object.keys(s).length>0?i.attributes=s:delete i.attributes}Array.isArray(i.classes)&&(i.classes=i.classes.map(s=>{let a=String(s);return a.startsWith("usr-")?a.slice(4):a}))}})}function bB(e){let t=a0(e);Pc(t),mB(t),pB(t),gB(t),hB(t),yB(t),SB(t);for(let n of t.animationTimeline?.tracks??[])l0(n);for(let n of t.library??[])if(!(n.kind!=="marker"&&n.kind!=="symbol"))for(let r of n.animations??[])l0(r);return t.schemaVersion=11,t}function p0(e){return e.schemaVersion=12,e}function vB(e){return e.schemaVersion=13,e}function xB(e){return e.schemaVersion=14,e}function m0(e){return ht(e,{onState:t=>{let n=t,r=n.authoredTextStructure;if(n.textSpanTree===void 0&&r&&typeof r.text=="string"&&Array.isArray(r.spans)){let i=r.spans.flatMap(o=>{if(!o||typeof o!="object"||Array.isArray(o))return[];let s=o;return typeof s.start=="number"&&typeof s.end=="number"&&typeof s.id=="string"?[{start:s.start,end:s.end,id:s.id,children:[]}]:[]});i.length===r.spans.length&&(n.textSpanTree={text:r.text,spans:i})}delete n.authoredTextStructure}}),e.schemaVersion=15,e}function g0(e){return e.schemaVersion=16,e}function h0(e){for(let t of e.documentStyles??[]){let n=t;n.placement??="root"}return e.schemaVersion=17,e}function y0(e){return e.schemaVersion=18,e}function S0(e){return ht(e,{onState:t=>{let n=t;n.textPathReference===void 0&&typeof n.textPathRefShapeId=="string"&&n.textPathRefShapeId.length>0&&(n.textPathReference={kind:"shape",targetId:n.textPathRefShapeId,element:"href"}),delete n.textPathRefShapeId,delete n.textPathImportRefId}}),e.schemaVersion=19,e}function IB(e){return e.schemaVersion=20,e}function wB(e){return e.schemaVersion=21,e}function kB(e){let t=new Map,n=(r,i,o)=>{let s=r.textSpanTree;if(!s||typeof s!="object"||Array.isArray(s))return;let a=s.spans;if(!Array.isArray(a))return;let c=new Map,l=(d,u=[])=>{d.forEach((f,p)=>{if(!f||typeof f!="object"||Array.isArray(f))return;let m=f,g=[...u,p],h=typeof m.spanId=="string"&&m.spanId.length>0?m.spanId:`text-span:${i}:${g.join(".")}`;m.spanId=h,c.set(g.join("."),h),Array.isArray(m.children)&&l(m.children,g)})};l(a),o&&t.set(o,c)};return ht(e,{onShape:(r,i)=>n(r.state,r.id||i,r.id),onState:(r,i)=>n(r,i)}),e.animationTimeline&&(e.animationTimeline.tracks=e.animationTimeline.tracks.filter(r=>{let i=r.textSpanTarget;if(!i||Array.isArray(i.spanIds))return!0;let o=Array.isArray(i.path)?i.path:[],s=o.every(c=>Number.isInteger(c)&&Number(c)>=0)?o.join("."):"",a=s?t.get(r.shapeId)?.get(s):void 0;return a?(i.spanIds=[a],delete i.path,!0):!1})),e.schemaVersion=22,e}function PB(e){let t=br(e),n=r=>{let i=r.authoredPlacement;if(!i||i.parentDefinitionId!==void 0)return;let o=t.resolve(i);o.kind==="library"&&(i.parentDefinitionId=o.definitionId)};for(let r of e.library??[])n(r);for(let r of e.paintServerDefs??[])n(r);for(let r of e.clipMaskGroups??[])n(r);return e.schemaVersion=23,e}function TB(e){return e.schemaVersion=24,e}function RB(e){return e.schemaVersion=25,e}function CB(e){return ht(e,{onShape(t){if(t.type!=="foreign-object")return;let n=t.state,r=n.rawContent;if(typeof r!="string")return;let i=Cn(`<svg xmlns="${te}"><foreignObject>${r}</foreignObject></svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"}).value,o=i?.index.children(i.root.sourceNodeId).find(s=>s.localName.toLowerCase()==="foreignobject");n.foreignContent=o?structuredClone(lc(o.children)):r.length===0?[]:[{kind:"text",value:r}],delete n.rawContent}}),e.schemaVersion=26,e}function AB(e){let t=typeof e.shapeId=="string"?e.shapeId:"";if(t.startsWith("__dom__")&&t.length>7)return t.slice(7);let n=typeof e.domTargetSelector=="string"?e.domTargetSelector:"",r=/\[id\s*=\s*(["'])(.*?)\1\]/u.exec(n);return r?.[2]?r[2]:/^#([A-Za-z_][\w:.-]*)$/u.exec(n.trim())?.[1]??null}function d0(e,t){return e?Cn(`<svg xmlns="${te}">${e}</svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"}).value?.nodes.some(r=>r.kind==="element"&&r.attributes.some(i=>i.namespaceUri===null&&i.localName==="id"&&i.value===t))??!1:!1}function NB(e,t){for(let n of e.clipMaskGroups??[]){let r=n.definitionId??`${n.type}-${n.id}`;if(r===t)return{definitionId:r};if(d0(n.rawDefinition,t))return{definitionId:r,nodeId:t}}for(let n of e.paintServerDefs??[]){if(n.id===t)return{definitionId:n.id};if(d0(n.markup,t))return{definitionId:n.id,nodeId:t}}for(let n of e.library??[]){if(n.id===t||n.sourceId===t)return{definitionId:n.id};if(n.kind==="filter")for(let r of n.filters){if(r.type!=="svg-primitive-chain")continue;let i=r.primitives.find(o=>o.id===t);if(i)return{definitionId:n.id,nodeId:i.id}}}return{definitionId:t}}function EB(e){let t=typeof e.property=="string"?e.property:"";if(t==="domTransformStack")return"targetTransformStack";if(t==="domDisplay")return"targetDisplay";if(t==="domVisibility")return"targetVisibility";if(t!=="domAttribute")return t;let n=typeof e.domAttribute=="string"?e.domAttribute:"",r=n.toLowerCase();return new Map([["class","className"],["fill","fillColor"],["stroke","strokeColor"],["preserveaspectratio","svgPreserveAspectRatio"],["xlink:href","referenceTargetShapeId"],["href","referenceTargetShapeId"],["clippathunits","clipPathUnits"],["spreadmethod","spreadMethod"]]).get(r)??n}function OB(e){let t=e.animationTimeline;for(let n of t?.tracks??[]){let r=n,i=AB(r);if(!i)continue;let o=NB(e,i);r.definitionTarget=o,r.shapeId=Or(o),r.property=EB(r),typeof r.domAttribute=="string"&&(r.targetAttribute=r.domAttribute),typeof r.domAttributeValueType=="string"&&(r.targetAttributeValueType=r.domAttributeValueType),delete r.domTargetSelector,delete r.domTargetIdGenerated,delete r.domAttribute,delete r.domAttributeValueType}return e.schemaVersion=27,e}function DB(e){return e.schemaVersion=28,e}function $B(e){let t=e.clipMaskGroups;if(!Array.isArray(t)||t.length===0)return e.schemaVersion=29,e;let n=new Set;for(let o of e.shapes)In(o,{onShape:s=>n.add(s.id)});let r=new Set;for(let o of t){let s=typeof o.rawDefinition=="string"&&o.rawDefinition.length>0,a=o.clipShapeIds.some(c=>n.has(c));(s||a)&&r.add(`${o.type}\0${Ut(o)}`)}let i=t.filter(o=>r.has(`${o.type}\0${Ut(o)}`));return i.length!==t.length&&(e.clipMaskGroups=rr(i),jr(e)),e.schemaVersion=29,e}var b0=Object.freeze({1:tB,2:Q1,3:eB,4:nB,5:iB,6:f0,7:lB,8:dB,9:uB,10:bB,11:p0,12:vB,13:xB,14:m0,15:g0,16:h0,17:y0,18:S0,19:IB,20:wB,21:kB,22:PB,23:TB,24:RB,25:CB,26:OB,27:DB,28:$B});function MB(e){let t=e.schemaVersion;return typeof t!="number"||!Number.isFinite(t)||t<1?1:Math.floor(t)}function Tc(e,t=b0){let n=JSON.parse(JSON.stringify(e)),r=MB(n);if(r>Tn)return n;if(r===Tn)return n.schemaVersion=Tn,n;for(;r<Tn;){let i=t[r];if(!i)throw new Error(`[svgsketch/core] No migration registered for schema version ${r} \u2192 ${r+1}. Cannot safely upgrade this document to version ${Tn}.`);n=i(n),r+=1}return n.schemaVersion=Tn,n}var zB=["unknown-shape-diagnostic","symbol-variants-overrides","smil-timeline","motion-only-partition","paint-server-references","filter-references","document-definition-context","inline-child-containers","isolated-flowchart-nodes","text-path","common-presentation","gradient-definition-envelope","filter-definition-envelope","export-precision-rounding","defs-deduplication","source-id-restoration","orphan-def-exclusion","font-embedding","initial-value-elision","namespace-declaration-completion"],ge=e=>({mode:"supported",by:e}),Gi=e=>({mode:"diagnostic",signal:"warning",by:e}),Oe=e=>({mode:"outside-contract",reason:e}),Ft=e=>e,v0=Oe("DXF is a static CAD geometry contract and has no representation for this SVG behavior."),x0=Oe("Mermaid is a static graph-structure contract and has no representation for this SVG behavior."),I0=Oe("PDF export produces a static page from the current editor SVG projection and does not promise animation playback."),FB={"unknown-shape-diagnostic":Ft({renderToSvg:Gi("renderShape reports UNSUPPORTED_SHAPE_TYPE through renderToSvgWithDiagnostics"),codegen:Gi("buildRenderPlan carries UNSUPPORTED_SHAPE_TYPE into generateCodeWithDiagnostics"),dxf:Gi("DxfExportStats records unsupported types and the DXF export UI reports them"),mermaid:Gi("exportMermaidWithDiagnostics records unsupported nodes and both Mermaid UIs report them"),pdf:Oe("PDF conversion consumes an already-projected editor SVG; unknown model nodes never enter its input."),"editor-dom":Oe("Unknown nodes are preserved for round-trip but require a registered shape implementation for projection.")}),"symbol-variants-overrides":Ft({renderToSvg:ge("buildRenderPlan materializes symbol variants and per-instance overrides before emission"),codegen:ge("every component backend consumes buildRenderPlan symbol materialization"),dxf:Gi("DXF unsupported-shape accounting reports symbol instances without a lowering"),mermaid:Gi("Mermaid node-skip diagnostics report symbol instances without a lowering"),pdf:ge("the editor projects SymbolInstance content into the SVG consumed by svg2pdf"),"editor-dom":ge("SymbolInstance projects resolved library variants and overrides")}),"smil-timeline":Ft({renderToSvg:ge("buildRenderPlan injects renderAnimationElements output into target and document-root markup"),codegen:ge("component backends preserve SMIL elements in planned target and document-root markup"),dxf:v0,mermaid:x0,pdf:I0,"editor-dom":ge("AnimationManager and the shared SMIL kernel project live playback")}),"motion-only-partition":Ft({renderToSvg:ge("buildRenderPlan diverts motionOnly templates into defs outside visible paint"),codegen:ge("component backends consume the render plan visible and motion-def partitions"),dxf:v0,mermaid:x0,pdf:I0,"editor-dom":Oe("The authoring DOM retains motion templates for editing instead of applying export partitioning.")}),"paint-server-references":Ft({renderToSvg:ge("plan defs and shapes use one library-first paint-server reference resolver"),codegen:ge("buildShapeAttrs and plan defs use the library-first reference resolver"),dxf:Oe("DXF promises geometry and basic entity colors, not SVG paint-server definition graphs."),mermaid:Oe("Mermaid graph syntax has no SVG gradient or pattern paint-server model."),pdf:ge("the cloned SVG carries paint-server definitions and references into svg2pdf"),"editor-dom":ge("GradientManager maintains live defs matching shape paint references")}),"filter-references":Ft({renderToSvg:ge("renderFilterDefs and filterReferenceValue emit matching identifiers"),codegen:ge("planned filter defs and buildShapeAttrs share filter reference resolution"),dxf:Oe("DXF entity geometry has no SVG filter graph or filter-reference representation."),mermaid:Oe("Mermaid graph syntax has no SVG filter graph or filter-reference representation."),pdf:ge("the cloned SVG carries filter definitions and references into svg2pdf"),"editor-dom":ge("FilterManager maintains live filter definitions and shape references")}),"document-definition-context":Ft({renderToSvg:ge("buildRenderPlan consumes the full snapshot definition and style context"),codegen:ge("component codegen accepts snapshot context and clipboard supplies its definitions"),dxf:Oe("DXF consumes resolved shapes and does not serialize SVG document definition sections."),mermaid:Oe("Mermaid consumes graph nodes and does not serialize SVG definition sections."),pdf:ge("PDF receives a cloned SVG document with its referenced definition context"),"editor-dom":ge("the document aggregate and managers project referenced resources into defs")}),"inline-child-containers":Ft({renderToSvg:ge("renderShape recursively renders INLINE_CHILD_CONTAINER_TYPES children"),codegen:ge("component backends preserve recursively rendered plan container markup"),dxf:ge("DXF walks INLINE_CHILD_CONTAINER_TYPES with transforms and cycle guards"),mermaid:Gi("unsupported container nodes are counted by exportMermaidWithDiagnostics"),pdf:ge("the cloned editor SVG preserves nested containers for svg2pdf"),"editor-dom":ge("registered containers project managed children into nested SVG elements")}),"isolated-flowchart-nodes":Ft({renderToSvg:Oe("Isolated-node declarations are a Mermaid graph concern, not an SVG branch."),codegen:Oe("Isolated-node declarations are a Mermaid graph concern, not component SVG output."),dxf:Oe("DXF emits geometry independently and has no connector-enrolment requirement."),mermaid:ge("exportMermaid declares mapped nodes before emitting connector edges"),pdf:Oe("PDF paints SVG geometry independently and has no graph-node declaration requirement."),"editor-dom":Oe("The live SVG projects shapes independently and has no graph-node declaration requirement.")}),"text-path":Ft({renderToSvg:ge("renderText emits textPath markup and its referenced or private path definition; the render plan routes textPathMorph SMIL into that private path or into textPath for the inline path form"),codegen:ge("component backends preserve planned textPath markup, path definitions and their textPathMorph SMIL children"),dxf:Oe("DXF text entities do not reproduce SVG textPath layout along arbitrary paths."),mermaid:Oe("Mermaid labels do not reproduce SVG textPath layout along arbitrary paths."),pdf:Gi("ExportPanel.generatePdfBlob detects textPath content and shows its localized warning"),"editor-dom":ge("Text projects textPath attributes and maintains its referenced path")}),"common-presentation":Ft({renderToSvg:ge("commonAttrs projects the ordered PRESENTATION_SEMANTICS vocabulary"),codegen:ge("buildShapeAttrs projects the ordered PRESENTATION_SEMANTICS vocabulary"),dxf:Oe("DXF is not an SVG presentation-attribute serialization contract."),mermaid:Oe("Mermaid is not an SVG presentation-attribute serialization contract."),pdf:ge("svg2pdf consumes common presentation attributes from the cloned SVG"),"editor-dom":ge("COMMON_PROP_RENDERERS derives its dispatch from PRESENTATION_SEMANTICS")}),"gradient-definition-envelope":Ft({renderToSvg:ge("gradient renderers serialize the shared typed definition envelopes"),codegen:ge("render plan defs contain gradients serialized from shared typed envelopes"),dxf:Oe("DXF has no SVG linearGradient or radialGradient definition envelope."),mermaid:Oe("Mermaid has no SVG linearGradient or radialGradient definition envelope."),pdf:ge("the cloned SVG supplies shared-envelope gradient definitions to svg2pdf"),"editor-dom":ge("GradientManager projects shared gradient envelopes into live defs")}),"filter-definition-envelope":Ft({renderToSvg:ge("renderFilterElement serializes filterDefinitionEnvelope for each wrapper kind"),codegen:ge("render plan defs contain filters serialized from shared typed envelopes"),dxf:Oe("DXF has no SVG filter element or primitive graph envelope representation."),mermaid:Oe("Mermaid has no SVG filter element or primitive graph envelope representation."),pdf:ge("the cloned SVG supplies shared-envelope filter definitions to svg2pdf"),"editor-dom":ge("FilterManager projects filterDefinitionEnvelope before primitive emission")}),"export-precision-rounding":Ft({renderToSvg:ge("finalizeRenderPlan rounds markup coordinates at the effective documentMetadata.coordinatePrecision"),codegen:Oe("Codegen backends consume the un-finalized render plan; component output precision is a code-style concern, not an export boundary."),dxf:Oe("DXF numeric precision is owned by the DXF writer, not the SVG export boundary."),mermaid:Oe("Mermaid emits graph syntax rather than SVG coordinate attribute streams."),pdf:ge("PDF viewbox pages consume the plan-assembled string (core rounding); selection pages pass through SvgExportFinalizer.roundSvgAttributes"),"editor-dom":ge("static string exports round through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks round through SvgExportFinalizer.roundSvgAttributes; the raster clone sink skips rounding by design (spelling-only, pixel-irrelevant)")}),"defs-deduplication":Ft({renderToSvg:ge("finalizeRenderPlan collapses content-identical gradient/pattern/marker defs and rewrites references"),codegen:Oe("Codegen backends consume the un-finalized render plan; def duplication in generated components is a code-size concern outside the export contract."),dxf:Oe("DXF output has no shared-definition graph in which duplicates could exist."),mermaid:Oe("Mermaid output has no shared-definition graph in which duplicates could exist."),pdf:ge("PDF viewbox pages consume the plan-assembled string (core dedup); selection pages pass through SvgExportFinalizer.deduplicateDefsForExport"),"editor-dom":ge("static string exports dedup through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks run SvgExportFinalizer.deduplicateDefsForExport; the raster clone sink skips dedup by design (spelling-only, pixel-irrelevant)")}),"source-id-restoration":Ft({renderToSvg:ge("finalizeRenderPlan restores uncontested library sourceIds and rewrites references"),codegen:Oe("Generated components keep collision-safe runtime ids; source ids are a document round-trip concern."),dxf:Oe("DXF entities carry no SVG id namespace for source ids to be restored into."),mermaid:Oe("Mermaid nodes carry no SVG id namespace for source ids to be restored into."),pdf:Oe("PDF output has no id namespace to restore; the intermediate SVG string restores ids for fidelity but the PDF consumer never observes them."),"editor-dom":ge("static string exports restore source ids through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks run SvgExportFinalizer.restoreSourceIds; the raster clone sink skips restoration by design (ids are spelling, not pixels)")}),"orphan-def-exclusion":Ft({renderToSvg:ge("def emission is demand-driven (collectReferencedLibraryDefs, the referenced-marker gate, the paint-server reachability fixed point) \u2014 unreferenced defs are never emitted, so no pruning pass exists or is needed"),codegen:ge("component backends consume the same demand-driven plan def channels"),dxf:Oe("DXF output has no defs graph from which orphans could need excluding."),mermaid:Oe("Mermaid output has no defs graph from which orphans could need excluding."),pdf:ge("the editor SVG consumed by svg2pdf passes through pruneOrphanedDefs"),"editor-dom":ge("static string exports are demand-driven via the core plan (no orphans emitted); the raster/selection clone sinks sweep accumulated live defs with SvgExportFinalizer.pruneOrphanedDefs")}),"font-embedding":Ft({renderToSvg:ge("finalizeRenderPlan ships @font-face CSS from the injected resolveFontEmbedCss hook (core is platform-free; binary resolution is the caller environment responsibility)"),codegen:Oe("Generated components inherit the host page font pipeline; embedding binaries in component source is out of contract."),dxf:Oe("DXF text styling is font-name based; the format has no font binary embedding."),mermaid:Oe("Mermaid delegates font resolution entirely to the rendering host page."),pdf:ge("svg2pdf consumes the editor SVG after the async export inlined @font-face CSS"),"editor-dom":ge("every sink that leaves the live document embeds: static and animated string exports resolve plan-collected FACES (family + weight + style) through fontManager into the core resolveFontEmbedCss hook, and the embedded-SVG subtree and selection exports run SvgExportFinalizer.embedFontsInOutput over the projected tree. Raster sinks embed too, subset to the characters they render - an SVG handed to an <img> is processed in secure static/animated mode (SVG 2 2.2.4/2.2.6), so it resolves no external references and inherits none of the session live font faces. Only the internal clipboard payload skips embedding, because the session that wrote it is the session that reads it")}),"initial-value-elision":Ft({renderToSvg:ge("finalizeRenderPlan drops redundant spec initials and product defaults under an initial-valued cascade (elideInitialValuesInPlan)"),codegen:Oe("Codegen backends consume the un-finalized plan; explicit values in component source are a readability choice, not an export-boundary concern."),dxf:Oe("DXF entities carry explicit CAD attributes with no SVG initial-value cascade."),mermaid:Oe("Mermaid emits graph syntax; SVG presentation initial values never appear in its output."),pdf:ge("PDF viewbox pages consume the plan-assembled string (core elision); selection pages pass through SvgExportFinalizer.stripDefaultPaintAttributes"),"editor-dom":ge("static string exports elide through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks run SvgExportFinalizer.stripDefaultPaintAttributes and the output-artifact rules; the raster clone sink keeps default attributes by design (elision is spelling-only)")}),"namespace-declaration-completion":Ft({renderToSvg:ge("finalizeRenderPlan declares used prefixes on the root via a well-known URI table (declareUsedNamespacePrefixes); unresolvable prefixes warn undeclarable-namespace-prefix"),codegen:Oe("Generated components render into a host document whose framework owns namespace handling; JSX/Vue templates have no xmlns declaration surface to complete."),dxf:Oe("DXF is not XML and has no namespace prefixes to declare or complete."),mermaid:Oe("Mermaid graph syntax is not XML; no namespace declarations exist."),pdf:ge("svg2pdf consumes the editor SVG string whose serializer declared every namespace it uses"),"editor-dom":ge("static string exports complete declarations through core declareUsedNamespacePrefixes; the raster/selection clone sinks rely on XMLSerializer plus hoistForeignNamespaceDecls")})};function Po(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}async function Nh(e,t,n,r){let i=e[t];typeof i=="string"&&(e[t]=await r(i,n))}async function Ah(e,t){Po(e)&&await Nh(e,"svgContent","svgMarkup",t)}async function Eh(e,t){if(!Po(e))return;await Nh(e,"href","href",t),await Ah(e.fillGradient,t),await Ah(e.strokeGradient,t);let n=e.children;if(Array.isArray(n))for(let r of n)Po(r)&&await Eh(r.state,t)}async function LB(e,t){if(!Po(e))return;let n=e.shapes;if(Array.isArray(n))for(let o of n)Po(o)&&await Eh(o.state,t);let r=e.library;if(Array.isArray(r))for(let o of r)Po(o)&&o.kind==="pattern"&&await Ah(o.pattern,t);let i=e.customPatterns;if(Array.isArray(i))for(let o of i)Po(o)&&await Nh(o,"svgContent","svgMarkup",t)}function Rc(e,t,n={}){let r=vo(e),i=r.errors.filter(o=>!n.ignoreError?.(o));if(i.length>0){let o=i.map(s=>` ${s.path}: ${s.message}`).join(`
|
|
41
|
+
${n}`:n}var b_=new Set(["animate","animatemotion","animatetransform","desc","metadata","mpath","set","title"]);function v_(e){switch(e.kind){case"text":return qg(e.value);case"comment":return`<!--${e.value}-->`;case"cdata":return`<![CDATA[${e.value.replaceAll("]]>","]]]]><![CDATA[>")}]]>`;case"processing-instruction":return`<?${e.value}?>`;case"doctype":return`<!DOCTYPE ${e.value}>`}}function Pk(e,t,n){let r=e.sourceNodeId===t,i=new Map(e.attributes.map(u=>[u.name,u.value])),o=e.attributes.map(u=>u.name),s=(u,f)=>{if(f===null){i.delete(u);return}i.has(u)||o.push(u),i.set(u,f)};r&&Object.prototype.hasOwnProperty.call(n,"clipPathUnits")&&s("clipPathUnits",n.clipPathUnits??null),n.clipRule!==void 0&&(r||!b_.has(e.localName.toLowerCase()))&&s("clip-rule",n.clipRule);let a=o.filter((u,f)=>o.indexOf(u)===f&&i.has(u)).map(u=>`${u}="${wk(i.get(u))}"`),c=`<${e.name}${a.length>0?` ${a.join(" ")}`:""}`,l=e.children.map(u=>u.kind==="element"?Pk(u,t,n):v_(u)).join(""),d=/\/\s*>\s*$/u.test(e.rawXml??"");return l.length===0&&d?`${c}/>`:`${c}>${l}</${e.name}>`}function x_(e,t){let n=Cn(`<svg xmlns="${te}">${e}</svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"});if(!n.value)return null;let r=n.value.index.children(n.value.root.sourceNodeId)[0];if(!r)return null;let i=r.localName.toLowerCase();return i!=="clippath"&&i!=="mask"?null:Pk(r,r.sourceNodeId,t)}function lu(e){let t=/^(https?):\/\/([^/?#\s\\]+)([^\s\\]*)$/iu.exec(e);if(!t)return null;let n=t[1].toLowerCase(),r=t[2],i=r.lastIndexOf("@"),o=i>=0?r.slice(0,i+1):"",s=r.slice(i+1);if(!s)return null;let a=s.startsWith("[")?s.slice(0,Math.max(0,s.indexOf("]")+1)).toLowerCase():s.split(":")[0].toLowerCase();if(!a)return null;let c=t[3]||"/",l=c.indexOf("?"),d=c.indexOf("#",Math.max(0,l)),u=l<0?"":c.slice(l+1,d<0?void 0:d);return Object.freeze({href:`${n}://${o}${s.toLowerCase()}${c}`,hostname:a,query:u})}function xk(e){try{return decodeURIComponent(e.replace(/\+/gu," "))}catch{return e.replace(/\+/gu," ")}}function Zg(e){let t=[],n=0,r=null,i=!1,o=0;for(let s=0;s<e.length;s++){let a=e[s];if(r){i?i=!1:a==="\\"?i=!0:a===r&&(r=null);continue}if(a==="/"&&e[s+1]==="*"){s=Math.max(s,ou(e,s)-1);continue}a==='"'||a==="'"?r=a:a==="("||a==="["?o++:a===")"||a==="]"?o=Math.max(0,o-1):a===","&&o===0&&(t.push(e.slice(n,s).trim()),n=s+1)}return t.push(e.slice(n).trim()),Object.freeze(t.filter(Boolean))}function Tk(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&(vk(e[n])||e[n]===",");)n++;if(n>=e.length)break;let r=n;for(;n<e.length&&!vk(e[n]);)n++;let i=e.slice(r,n);if(i.endsWith(",")){i=i.replace(/,+$/u,""),i&&t.push(i);continue}i&&t.push(i);let o=0;for(;n<e.length;){let s=e[n++];if(s==="(")o++;else if(s===")")o=Math.max(0,o-1);else if(s===","&&o===0)break}}return Object.freeze(t)}function Qg(e){if(typeof e!="string")return null;let t=au(Zg(e)[0]??"").trim();return!t||dc(t)?null:t}function I_(e){let t=[];for(let n of ri(e,";")){let r=e.slice(n.start,n.end),i=ri(r,":",!0)[0]?.end??r.length;if(i>=r.length)continue;let o=r.slice(0,i).trim().toLowerCase(),s=r.slice(i+1).trim();o&&t.push(Object.freeze({property:o,value:s}))}return Object.freeze(t)}function w_(e){let t=$r(e).find(n=>n.name==="format");return t&&au(e.slice(t.argumentsStart,t.argumentsEnd))||null}var k_=Object.freeze({"font-style":"style","font-weight":"weight","font-stretch":"stretch","font-display":"display","unicode-range":"unicodeRange","font-feature-settings":"featureSettings","font-variation-settings":"variationSettings","ascent-override":"ascentOverride","descent-override":"descentOverride","line-gap-override":"lineGapOverride","size-adjust":"sizeAdjust"});function P_(e){let t={};for(let n of e){let r=k_[n.property];r&&n.value&&(t[r]=n.value)}return Object.keys(t).length>0?Object.freeze(t):void 0}function Jg(e){let t=[];for(let n of su(e)){if(n.name!=="font-face"||n.blockStart===null||n.blockEnd===null)continue;let r=I_(e.slice(n.blockStart,n.blockEnd)),i=Qg(r.find(a=>a.property==="font-family")?.value),o=r.find(a=>a.property==="src")?.value;if(!i||!o)continue;let s=P_(r);for(let a of Zg(o)){let c=cu(a);if(c===null)continue;let l=bo(c);l.status!=="external"||!l.requestUrl||t.push(Object.freeze({family:i,url:l.requestUrl,format:w_(a),...s?{descriptors:s}:{}}))}}return Object.freeze(t)}function Rk(e){let t=[];for(let n of su(e)){if(n.name!=="import")continue;let r=cu(e.slice(n.preludeStart,n.preludeEnd));if(r===null)continue;let i=bo(r);if(i.status!=="external"||!i.requestUrl)continue;let o=lu(i.requestUrl);if(!o||o.hostname!=="fonts.googleapis.com")continue;let s=o.query.split("&").map(a=>a.split("=",2)).filter(([a])=>xk(a).toLowerCase()==="family").map(([,a])=>xk(a??""));for(let a of s)for(let c of a.split("|")){let l=c.split(":")[0].trim();l&&!dc(l)&&t.push(l)}}return Object.freeze(t)}function T_(e){return ri(e,";").map(t=>{let n=e.slice(t.start,t.end),r=ri(n,":",!0)[0]?.end??n.length;if(r>=n.length||n.slice(0,r).trim().toLowerCase()!=="src")return n;let o=n.slice(0,r+1),s=Zg(n.slice(r+1)).filter(a=>{let c=cu(a);return c===null||bo(c).status==="data"});return`${o} ${s.length>0?s.join(", "):'local("__svgsketch_quarantined_font__")'}`}).join(";")}function iu(e){let t=[];for(let i of su(e)){if(i.name==="import"){t.push({start:i.start,end:i.end,value:"/* external stylesheet import quarantined */"});continue}i.name!=="font-face"||i.blockStart===null||i.blockEnd===null||t.push({start:i.blockStart,end:i.blockEnd,value:T_(e.slice(i.blockStart,i.blockEnd))})}let n=e;for(let i of t.sort((o,s)=>s.start-o.start))n=`${n.slice(0,i.start)}${i.value}${n.slice(i.end)}`;let r=Yg(n).filter(i=>{let o=i.rawUrl.trim();return!o||o.startsWith("#")?!1:bo(o).status!=="data"}).sort((i,o)=>o.tokenStart-i.tokenStart);for(let i of r)n=`${n.slice(0,i.tokenStart)}url("data:application/octet-stream;base64,")${n.slice(i.tokenEnd)}`;return n}function R_(e,t,n){let r=[];for(let i of t.stylesheets)if(i.applicable){for(let o of Rk(i.authoredText))r.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"google-font-import",family:o}));for(let o of Jg(i.authoredText))r.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"external-font-face",family:o.family,url:o.url,format:o.format,...o.descriptors?{descriptors:o.descriptors}:{}}))}for(let i of e.index.elements)for(let o of i.attributes)if(!(o.namespaceUri!==p_||o.localName!=="fonts"))for(let s of o.value.split(",")){let a=s.replace(/\+/gu," ").trim();!a||a.includes("/")||dc(a)||r.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"boxy-fonts",family:a}))}for(let i of n.candidates){if(i.canonicalType!=="text"||i.status!=="materialized")continue;let o=a=>{let c=Qg(a);c&&r.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:i.occurrenceId,origin:"text-font-family",family:c}))};o(i.state.fontFamily);let s=Oi(i.state);if(s){o(s.baseStyle.fontFamily);for(let a of s.runs)o(a.style.fontFamily)}}return Object.freeze(r)}function Bn(e,t){return e.attributes.find(n=>n.namespaceUri===null&&n.localName.toLowerCase()===t.toLowerCase())?.value??null}function Wg(e){return e.children.map(t=>t.kind==="text"||t.kind==="cdata"?t.value:"").join("")}function eh(e,t){let n=[],r=[...e.index.children(t)].reverse();for(;r.length>0;){let i=r.pop();n.push(i),r.push(...[...e.index.children(i.sourceNodeId)].reverse())}return Object.freeze(n)}function Vn(e,t){let n=bo(t.href);e.push(Object.freeze({...t,...n}))}function _i(e,t,n,r=new Set(["css-import","css-url"]),i=()=>!0){for(let o of g_(t))!r.has(o.channel)||!i(o)||o.url.trim().startsWith("#")||Vn(e,{...n,occurrenceId:`${n.occurrenceId}:css:${o.tokenIndex}`,channel:o.channel,href:o.url,hrefNamespace:null})}function Ck(e,t,n,r){for(let i of eh(t,n.sourceNodeId)){let o=i.localName.toLowerCase(),s=Bn(i,"id"),a={sourceNodeId:i.sourceNodeId,occurrenceId:`${r}:foreign:${i.sourceNodeId}`,sourceId:s,elementName:i.localName},c=[{attributeName:"src",channel:"html-src",applies:["img","video","audio","source","track","iframe","embed"].includes(o)||o==="input"&&Bn(i,"type")?.toLowerCase()==="image"},{attributeName:"poster",channel:"html-poster",applies:o==="video"},{attributeName:"data",channel:"html-data",applies:o==="object"},{attributeName:"href",channel:"html-src",applies:o==="link"&&(Bn(i,"rel")??"").split(/\s+/u).some(u=>u.toLowerCase()==="stylesheet")}];for(let u of c){if(!u.applies)continue;let f=Bn(i,u.attributeName);f!==null&&Vn(e,{...a,occurrenceId:`${a.occurrenceId}:${u.attributeName}`,attributeName:u.attributeName,channel:u.channel,href:f,hrefNamespace:null})}let l=Bn(i,"srcset");if(l!==null&&(o==="img"||o==="source"))for(let[u,f]of Tk(l).entries())Vn(e,{...a,occurrenceId:`${a.occurrenceId}:srcset:${u}`,attributeName:"srcset",channel:"html-srcset",href:f,hrefNamespace:null});let d=Bn(i,"style");d!==null&&_i(e,d,{...a,attributeName:"style"}),o==="style"&&_i(e,Wg(i),{...a,attributeName:"textContent"})}}function C_(e,t,n,r){let i=Bn(n,"data-shape-type")?.toLowerCase();if(i==="video"||i==="audio"){let o=eh(t,n.sourceNodeId).find(s=>s.localName.toLowerCase()===i);if(o){let s=Bn(o,"src")??"";if(Vn(e,{sourceNodeId:o.sourceNodeId,occurrenceId:`${r}:media:src`,sourceId:Bn(o,"id"),elementName:i,attributeName:"src",channel:"html-src",href:s,hrefNamespace:null}),i==="video"){let a=Bn(n,"data-poster")??Bn(o,"poster");a!==null&&Vn(e,{sourceNodeId:n.sourceNodeId,occurrenceId:`${r}:media:poster`,sourceId:Bn(n,"id"),elementName:"video",attributeName:"poster",channel:"html-poster",href:a,hrefNamespace:null})}}return}Ck(e,t,n,r)}function A_(e,t,n){let r=[];for(let i of t.occurrences){let o=e.index.element(i.correspondingSourceNodeId);if(!o||o.namespaceUri!==te)continue;let s=o.localName.toLowerCase();if(s==="image"||s==="feimage"){let a=at(o)??{value:"",namespace:"svg2"};Vn(r,{sourceNodeId:o.sourceNodeId,occurrenceId:i.occurrenceId,sourceId:E(o,"id"),elementName:s==="feimage"?"feImage":"image",attributeName:"href",channel:"svg-href",href:a.value,hrefNamespace:a.namespace})}else s==="foreignobject"&&C_(r,e,o,i.occurrenceId)}for(let i of n.stylesheets)i.applicable&&_i(r,i.authoredText,{sourceNodeId:i.sourceNodeId,occurrenceId:`style:${i.sourceNodeId}`,sourceId:i.id,elementName:"style",attributeName:"textContent"},new Set(["css-import"]),o=>lu(o.url)?.hostname!=="fonts.googleapis.com");for(let i of n.elements){let o=e.index.element(i.correspondingSourceNodeId);if(!(!o||o.namespaceUri!==te))for(let s of Object.values(i.cascadedValues))_i(r,s.value,{sourceNodeId:s.sourceNodeId,occurrenceId:`style:${i.occurrenceId}:${s.propertyName}`,sourceId:null,elementName:"style-declaration",attributeName:s.propertyName})}return Object.freeze(r)}function Ak(e,t,n){let r=[...new Set(e.filter(d=>d.origin==="google-font-import"||d.origin==="boxy-fonts").map(d=>d.family))].sort(),i=[],o=new Set;for(let d of e){if(d.origin!=="external-font-face"||!d.url)continue;let u=`${d.family}\0${d.url}\0${d.format??""}\0${JSON.stringify(d.descriptors??{})}`;o.has(u)||(o.add(u),i.push(Object.freeze({family:d.family,url:d.url,format:d.format??null,...d.descriptors?{descriptors:d.descriptors}:{}})))}i.sort((d,u)=>d.family.localeCompare(u.family)||d.url.localeCompare(u.url)||(d.format??"").localeCompare(u.format??""));let s=[...new Set([...r,...i.map(d=>d.family)])].sort(),a=[...new Set(t.filter(d=>d.status==="external"&&d.requestUrl).map(d=>d.requestUrl))].sort(),c=[];s.length>0&&c.push(Object.freeze({kind:"font-consent",families:s,googleFamilies:r,...i.length>0?{externalSources:i}:{}})),a.length>0&&c.push(Object.freeze({kind:"external-asset-resolution",urls:a})),Object.freeze(s),Object.freeze(r),Object.freeze(i),Object.freeze(a),Object.freeze(c);let l=Object.freeze({fontCandidates:e,assetCandidates:t,effects:c});return Object.freeze({value:l,diagnostics:n})}function th(e,t,n,r,i){return Ak(R_(e,n,r),A_(e,t,n),Object.freeze([]))}function N_(e){let t=e.state,n=t.extra;return typeof n=="object"&&n!==null&&!Array.isArray(n)?{...n,...t}:t}function nh(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rh(e,t,n){for(let r of Rk(t))e.push(Object.freeze({sourceNodeId:n,occurrenceId:null,origin:"google-font-import",family:r}));for(let r of Jg(t))e.push(Object.freeze({sourceNodeId:n,occurrenceId:null,origin:"external-font-face",family:r.family,url:r.url,format:r.format,...r.descriptors?{descriptors:r.descriptors}:{}}))}function Nk(e,t,n,r){rh(e,n,r),_i(t,n,{sourceNodeId:r,occurrenceId:r,sourceId:null,elementName:"style",attributeName:"textContent"},void 0,o=>lu(o.url)?.hostname!=="fonts.googleapis.com");let i=new Set(Jg(n).map(o=>o.url));for(let o=t.length-1;o>=0;o--){let s=t[o];s.sourceNodeId===r&&i.has(s.requestUrl??"")&&t.splice(o,1)}}function E_(e,t,n,r){let i=[],o=c=>{c.kind==="element"&&(i.push(c),c.children.forEach(o))};n.forEach(o);let s=(c,l)=>c.attributes.find(d=>d.namespaceUri===null&&d.localName.toLowerCase()===l)?.value??null,a=c=>c.children.flatMap(l=>l.kind==="text"||l.kind==="cdata"?[l.value]:[]).join("");for(let[c,l]of i.entries()){let d=l.localName.toLowerCase(),u=s(l,"id"),f={sourceNodeId:`${r}:foreign:${c}`,occurrenceId:`${r}:foreign:${c}`,sourceId:u,elementName:l.localName},p=[{attributeName:"src",channel:"html-src",applies:["img","video","audio","source","track","iframe","embed"].includes(d)||d==="input"&&s(l,"type")?.toLowerCase()==="image"},{attributeName:"poster",channel:"html-poster",applies:d==="video"},{attributeName:"data",channel:"html-data",applies:d==="object"},{attributeName:"href",channel:"html-src",applies:d==="link"&&(s(l,"rel")??"").split(/\s+/u).some(h=>h.toLowerCase()==="stylesheet")}];for(let h of p){if(!h.applies)continue;let y=s(l,h.attributeName);y!==null&&Vn(t,{...f,occurrenceId:`${f.occurrenceId}:${h.attributeName}`,attributeName:h.attributeName,channel:h.channel,href:y,hrefNamespace:null})}let m=s(l,"srcset");if(m!==null&&(d==="img"||d==="source"))for(let[h,y]of Tk(m).entries())Vn(t,{...f,occurrenceId:`${f.occurrenceId}:srcset:${h}`,attributeName:"srcset",channel:"html-srcset",href:y,hrefNamespace:null});let g=s(l,"style");if(g!==null&&_i(t,g,{...f,attributeName:"style"}),d==="style"){let h=a(l);rh(e,h,f.sourceNodeId),_i(t,h,{...f,attributeName:"textContent"})}}}function ih(e,t,n,r){_i(e,t,{sourceNodeId:n,occurrenceId:`${n}:${r}`,sourceId:null,elementName:"canonical-state",attributeName:r})}function uc(e,t,n){if(nh(t))for(let[r,i]of Object.entries(t))typeof i=="string"&&ih(e,i,n,r)}function oh(e,t,n,r,i,o){if(Array.isArray(n))for(let[s,a]of n.entries()){if(!nh(a))continue;let c=`${r}:filter:${s}`;a.type==="feImage"&&Vn(t,{sourceNodeId:r,occurrenceId:c,sourceId:null,elementName:"feImage",attributeName:"href",channel:"canonical-state",href:typeof a.href=="string"?a.href:typeof a.xlinkHref=="string"?a.xlinkHref:"",hrefNamespace:typeof a.href=="string"?"svg2":"xlink"}),a.type==="raw-svg"&&typeof a.svgContent=="string"&&fc(e,t,a.svgContent,`${c}:raw`,i,o),oh(e,t,a.primitives,`${c}:primitives`,i,o)}}function Xg(e,t,n,r,i,o){!nh(n)||typeof n.svgContent!="string"||fc(e,t,n.svgContent,r,i,o)}function O_(e,t,n,r,i,o){let s=N_(n),a=`snapshot:${r}:${n.id}`;if(n.type==="text"){let c=d=>{let u=Qg(d);u&&e.push(Object.freeze({sourceNodeId:a,occurrenceId:a,origin:"text-font-family",family:u}))};c(s.fontFamily);let l=Oi(s);if(l){c(l.baseStyle.fontFamily);for(let d of l.runs)c(d.style.fontFamily)}}n.type==="image"?Vn(t,{sourceNodeId:a,occurrenceId:a,sourceId:n.id,elementName:"image",attributeName:"href",channel:"canonical-state",href:typeof s.href=="string"?s.href:"",hrefNamespace:null}):n.type==="video"||n.type==="audio"?(Vn(t,{sourceNodeId:a,occurrenceId:`${a}:src`,sourceId:n.id,elementName:n.type,attributeName:"href",channel:"canonical-state",href:typeof s.href=="string"?s.href:"",hrefNamespace:null}),n.type==="video"&&typeof s.posterHref=="string"&&Vn(t,{sourceNodeId:a,occurrenceId:`${a}:poster`,sourceId:n.id,elementName:"video",attributeName:"posterHref",channel:"canonical-state",href:s.posterHref,hrefNamespace:null})):n.type==="foreign-object"&&Array.isArray(s.foreignContent)&&E_(e,t,s.foreignContent,a),Xg(e,t,s.fillGradient,`${a}:fillGradient`,i,o),Xg(e,t,s.strokeGradient,`${a}:strokeGradient`,i,o),oh(e,t,s.filters,a,i,o),uc(t,s.authoredAttributes,`${a}:authored`),uc(t,s.containerPresentation,`${a}:container-presentation`),uc(t,s.instancePresentation,`${a}:instance-presentation`),uc(t,s.cssMaskProperties,`${a}:mask`),typeof s.cssClipPath=="string"&&ih(t,s.cssClipPath,a,"clip-path")}function fc(e,t,n,r,i,o){let s=Cn(`<svg xmlns="${te}">${n}</svg>`,i);if(!s.value){o.push(...s.diagnostics.map(c=>Object.freeze({...c,severity:"warning",message:`Canonical raw definition could not be inspected for external requests: ${c.message}`,documentPath:r})));return}let a=new Set;for(let c of s.value.index.elements){if(c.localName.toLowerCase()!=="foreignobject")continue;let l=`${r}:${c.sourceNodeId}`;Ck(t,s.value,c,l);for(let d of eh(s.value,c.sourceNodeId))a.add(d.sourceNodeId),d.localName.toLowerCase()==="style"&&rh(e,Wg(d),`${r}:${d.sourceNodeId}`)}for(let c of s.value.index.elements){if(a.has(c.sourceNodeId))continue;let l=c.localName.toLowerCase();if(c.namespaceUri===te&&(l==="image"||l==="feimage")){let d=at(c)??{value:"",namespace:"svg2"};Vn(t,{sourceNodeId:`${r}:${c.sourceNodeId}`,occurrenceId:`${r}:${c.sourceNodeId}`,sourceId:Bn(c,"id"),elementName:l==="feimage"?"feImage":"image",attributeName:"href",channel:"canonical-state",href:d.value,hrefNamespace:d.namespace})}l==="style"&&Nk(e,t,Wg(c),`${r}:${c.sourceNodeId}:style`);for(let d of c.attributes)d.localName.toLowerCase()==="href"||d.localName.toLowerCase()==="src"||ih(t,d.value,`${r}:${c.sourceNodeId}`,d.name)}}function D_(e,t){let n=[],r=[],i=[];for(let[s,a]of(e.documentStyles??[]).entries())Nk(n,r,a.css,`snapshot:documentStyles[${s}]`);ht(e,{onShape:(s,a)=>O_(n,r,s,a,t,i)});for(let[s,a]of(e.library??[]).entries()){let c=`snapshot:library[${s}]`;a.kind==="pattern"?Xg(n,r,a.pattern,`${c}:pattern`,t,i):a.kind==="filter"?oh(n,r,a.filters,`${c}:filters`,t,i):(a.kind==="symbol"||a.kind==="marker")&&uc(r,a.rootAttributes,`${c}:root`)}let o=e.documentMetadata?.rawHtmlMetadata;typeof o=="string"&&fc(n,r,o,"snapshot:documentMetadata.rawHtmlMetadata",t,i);for(let[s,a]of(e.paintServerDefs??[]).entries())fc(n,r,a.markup,`snapshot:paintServerDefs[${s}]`,t,i);for(let[s,a]of(e.clipMaskGroups??[]).entries())a.rawDefinition&&fc(n,r,a.rawDefinition,`snapshot:clipMaskGroups[${s}].rawDefinition`,t,i);return Ak(Object.freeze(n),Object.freeze(r),Object.freeze(i))}function $_(e,t,n){let r=new Set,i=o=>{let s=o;for(;s;){let a=s.localName.toLowerCase();if(a==="clippath"||a==="mask")return!0;s=e.index.parent(s.sourceNodeId)}return!1};for(let o of n.css){let s=t.occurrence(o.occurrenceId);if(!s)continue;let a=e.index.element(s.correspondingSourceNodeId);a&&i(a)&&r.add(a.sourceNodeId)}return e.index.elements.filter(o=>r.has(o.sourceNodeId)).map(o=>o.sourceNodeId)}var Ek=Object.freeze({matchesMedia(e){let t=e.trim().toLowerCase();return t===""||t==="all"||t==="screen"},supportsCondition(){return!1}}),M_=new Map([["clippath","clip-path"],["marker","marker"],["mask","mask"],["pattern","pattern"]]);function z_(e){return Object.freeze(e.index.elements.flatMap(t=>{let n=M_.get(t.localName.toLowerCase());return n?[Object.freeze({sourceNodeId:t.sourceNodeId,capability:n})]:[]}))}function F_(e,t,n){let r=new Map(e.occurrences.map(i=>[i.occurrenceId,i]));return Object.freeze([...t.candidates.filter(i=>i.status==="materialized").map(i=>i.occurrenceId),...n.uses.filter(i=>["symbol-instance","linked-reference"].includes(i.status)).map(i=>i.useOccurrenceId)].filter(i=>r.get(i)?.role!=="definition"))}function du(e,t={}){let n={source:t.source??"svg",entrypoint:t.entrypoint??"svg-document-import"},r=Cn(e,n,t.xmlHost);if(!r.value)return Object.freeze({value:null,diagnostics:r.diagnostics});let i=r.value,o=om(i.root,n),s=Object.freeze({width:o.value.viewBoxWidth??300,height:o.value.viewBoxHeight??150}),a=t.rootFontSize??16,c=Object.freeze({viewport:Object.freeze({x:o.value.viewBoxX??0,y:o.value.viewBoxY??0,...s}),rootFontSize:a}),l=gm(i,n),d=l.value.condition(i.root.sourceNodeId),u=yg(i,n),f=_g(i,n),p=bm(i,{...n,resourceRoots:z_(i),...t.maxUseDepth!==void 0?{maxDepth:t.maxUseDepth}:{},...t.maxUseOccurrences!==void 0?{maxOccurrences:t.maxUseOccurrences}:{}}),m=Om(i,p,{...n,environment:t.styleEnvironment??Ek}),g=qa(i,p,m.value,{viewport:s,rootFontSize:a}),h=Qm(i,p,m.value,{...n,viewport:s,rootFontSize:a,viewportPlan:g,...t.textMetricsHost?{textMetricsHost:t.textMetricsHost}:{}}),y=$m(i,p,m.value,{...n,leafGeometry:h.value}),S=ym(i,{...t.claimedIds?{claimedIds:t.claimedIds}:{},cssAnimationTargetSourceNodeIds:$_(i,p,y.value)}),b=S.liveIdForSourceNodeId(i.root.sourceNodeId),I=Object.freeze({...o.value,...b?{svgId:b}:{},...d?.systemLanguage!==null&&d?.systemLanguage!==void 0?{systemLanguage:d.systemLanguage}:{},...d?.requiredExtensions!==null&&d?.requiredExtensions!==void 0?{requiredExtensions:d.requiredExtensions}:{}}),v=Gg(i,S),w=wm(i,{...n,appliedDeclarations:m.value.appliedResourceDeclarations}),k=og(i,p,m.value,w,h.value,{...n,viewport:s,rootFontSize:a}),C=new Set;for(let H of k.value.definitions)if(H.representation==="decomposed")for(let ie of H.geometrySourceNodeIds)C.add(ie);for(let H of y.value.smil)H.motionPathSourceNodeId&&C.add(H.motionPathSourceNodeId);let P=vm(i,p,m.value,{...n,nativeDefinitionSourceNodeIds:C,privateGeometrySourceNodeIds:new Set(h.value.privateTextPathGeometry.map(H=>H.pathSourceNodeId))}),R=pg(i,p,m.value,w,{...n,viewport:s,rootFontSize:a}),N=sg(i,p,m.value,w,{...n,viewport:s,rootFontSize:a}),M=cg(i,p,m.value,w,{...n,viewport:s,rootFontSize:a}),A=lg(i,p,m.value,w,{...n,viewport:s,rootFontSize:a}),$=fg(i,S,n),_=am(i,n),z=cm(i,p,g,n),j=km(i),G=th(i,p,m.value,h.value,n),W=dm(i,p,{...n,materializedOccurrenceIds:F_(p,h.value,P)}),V=[...r.diagnostics,...o.diagnostics,...l.diagnostics,...u.diagnostics,...f.diagnostics,...p.diagnostics,...m.diagnostics,...y.diagnostics,...P.diagnostics,...h.diagnostics,...w.diagnostics,...k.diagnostics,...R.diagnostics,...N.diagnostics,...M.diagnostics,...A.diagnostics,...$.diagnostics,..._.diagnostics,...z.diagnostics,...G.diagnostics,...W.diagnostics],X=Object.freeze({projectionContext:c,sourceDocument:i,rootFrame:I,identifiers:S,conditionalProcessing:l.value,scripts:u.value,metadata:f.value,documentExtensions:v,useOccurrences:p,styles:m.value,viewportContexts:g,animations:y.value,symbolUses:P,leafGeometry:h.value,resourceDependencies:w,clipMasks:k.value,filters:R.value,markers:N.value,gradients:M.value,patterns:A.value,paintServerDefinitions:$.value,views:_.value,embeddedFrames:z.value,authoredAttributes:j,externalEffects:G.value,hierarchy:W.value});return Object.freeze({value:X,diagnostics:Object.freeze(V)})}function me(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`id-${crypto.randomUUID()}`:`id-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function pc(e={}){let t={schemaVersion:Tn,shapes:e.shapes?e.shapes.map(n=>({...n})):[],viewboxes:e.viewboxes?e.viewboxes.map(n=>({...n})):[]};return e.metadata&&(t.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{},...e.metadata}),t}function L_(e){let{type:t,id:n,...r}=e,i={};for(let[o,s]of Object.entries(r))s!==void 0&&(i[o]=s);return{id:n??me(),type:t,state:i}}function ks(e,t,n,r,i){return{id:i??me(),x:e,y:t,width:n,height:r}}var uu=class{schemas=new Map;register(t,n){this.schemas.set(t,n)}get(t){return this.schemas.get(t)}typeIds(){return[...this.schemas.keys()]}getDefaults(t){let n=this.schemas.get(t);if(!n)return{};let r={};for(let i of Object.keys(n))r[i]=n[i].default;return r}validate(t,n,r){let i=this.schemas.get(t);if(!i)return r;let o=i[n];return o?.validate?o.validate(r):r}},Ee=e=>Math.max(0,e),Ps=e=>Math.max(0,Math.min(1,e)),zt=e=>Math.max(0,Math.min(100,e)),__=e=>Math.max(1,e),B_=e=>Math.max(3,Math.min(100,Math.floor(e))),V_=e=>Math.max(3,Math.min(50,Math.floor(e))),G_=e=>Math.max(3,Math.min(30,Math.floor(e))),j_=e=>Math.max(1,Math.min(10,e)),U_=e=>!e||typeof e!="object"||Array.isArray(e)||e.kind!=="shape"&&e.kind!=="definition"||typeof e.targetId!="string"||e.targetId.length===0||e.element!=="href"&&e.element!=="mpath"?null:{kind:e.kind,targetId:e.targetId,element:e.element};function H_(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{default:n}]))}var K_=H_(Hb),kt={layerName:{default:null},fillColor:{default:"#ffffff"},borderColor:{default:"#000000"},borderWidth:{default:1},opacity:{default:1,validate:Ps},fillOpacity:{default:1,validate:Ps},strokeOpacity:{default:1,validate:Ps},...K_,locked:{default:!1},visible:{default:!0},fillType:{default:"solid"},fillGradient:{default:null},strokeType:{default:"solid"},strokeGradient:{default:null},fillRule:{default:"nonzero"},strokeLinejoin:{default:"miter"},strokeLinecap:{default:"butt"},strokeMiterlimit:{default:4,validate:__},lineStyle:{default:"solid"},dashLength:{default:8},gapLength:{default:4},dashOffset:{default:0},strokeDasharray:{default:null},colorInterpolation:{default:null},filters:{default:[]},filterColorInterpolation:{default:null},filterUnits:{default:null},primitiveUnits:{default:null},filterX:{default:null},filterY:{default:null},filterWidth:{default:null},filterHeight:{default:null},metadata:{default:null},cssClipPath:{default:null},cssMaskProperties:{default:null}},nr={...kt,cx:{default:0},cy:{default:0},radius:{default:50,validate:Ee},cornerRadius:{default:0,validate:Ee},shiftAngle:{default:0}},Ts={...kt,x:{default:0},y:{default:0},width:{default:100,validate:Ee},height:{default:60,validate:Ee}},Ok={...kt,x:{default:0},y:{default:0},width:{default:0,validate:Ee},height:{default:0,validate:Ee},href:{default:""},mediaMimeType:{default:""},originalWidth:{default:0},originalHeight:{default:0},naturalDuration:{default:0},preserveAspectRatio:{default:!0},begin:{default:0},trimStart:{default:0},volume:{default:1,validate:Ps},muted:{default:!1},loop:{default:!1},playbackRate:{default:1},mediaOpacity:{default:1,validate:Ps},fadeInDuration:{default:0,validate:Ee},fadeOutDuration:{default:0,validate:Ee},posterHref:{default:""},sourceRect:{default:null}},Te=new uu;Te.register("rectangle",{...kt,x:{default:0},y:{default:0},width:{default:100,validate:Ee},height:{default:100,validate:Ee},rx:{default:0,validate:Ee},ry:{default:0,validate:Ee},cornerRadius:{default:0,validate:Ee},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:Ee},cornerRadiusTR:{default:0,validate:Ee},cornerRadiusBL:{default:0,validate:Ee},cornerRadiusBR:{default:0,validate:Ee},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});Te.register("square",{...kt,x:{default:0},y:{default:0},size:{default:100,validate:Ee},width:{default:100,validate:Ee},height:{default:100,validate:Ee},rx:{default:0,validate:Ee},ry:{default:0,validate:Ee},cornerRadius:{default:0,validate:Ee},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:Ee},cornerRadiusTR:{default:0,validate:Ee},cornerRadiusBL:{default:0,validate:Ee},cornerRadiusBR:{default:0,validate:Ee},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});Te.register("circle",{...kt,x:{default:0},y:{default:0},radius:{default:50,validate:Ee}});Te.register("ellipse",{...kt,x:{default:0},y:{default:0},rx:{default:50,validate:Ee},ry:{default:30,validate:Ee}});Te.register("line",{...kt,fillType:{default:"none"},x1:{default:0},y1:{default:0},x2:{default:100},y2:{default:0},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});Te.register("text",{...kt,x:{default:0},y:{default:0},width:{default:0,validate:Ee},height:{default:0,validate:Ee},textX:{default:0},textY:{default:0},fontSize:{default:24},text:{default:""},fontFamily:{default:"Arial"},fontWeight:{default:"normal"},fontStyle:{default:"normal"},fontStretch:{default:"normal"},fontSizeAdjust:{default:"none"},fontVariant:{default:""},fontVariantLigatures:{default:""},fontVariantPosition:{default:""},fontVariantCaps:{default:""},fontVariantNumeric:{default:""},fontVariantEastAsian:{default:""},textDecoration:{default:{}},textTransform:{default:"none"},baselineShift:{default:"baseline"},dominantBaseline:{default:"auto"},alignmentBaseline:{default:"auto"},writingMode:{default:"horizontal-tb"},textAnchor:{default:"start"},letterSpacing:{default:0},wordSpacing:{default:0},lineHeight:{default:1.2},inlineSize:{default:0},overflowWrap:{default:"normal"},whiteSpace:{default:"pre-wrap"},textDirection:{default:"ltr"},unicodeBidi:{default:"normal"},scaleX:{default:1},scaleY:{default:1},scaleAnchor:{default:null},useRichText:{default:!1},richTextRuns:{default:null},charOffsets:{default:null},fontVariationSettings:{default:{}},isTextPath:{default:!1},textPathPoints:{default:null},textPathStartOffset:{default:0},textPathSide:{default:"left"},textPathReference:{default:null,validate:U_},shapeInsideRef:{default:null},shapePadding:{default:0}});Te.register("image",{...kt,x:{default:0},y:{default:0},width:{default:100,validate:Ee},height:{default:100,validate:Ee},href:{default:""},originalWidth:{default:0},originalHeight:{default:0},preserveAspectRatio:{default:!0},imageOpacity:{default:1,validate:Ps}});Te.register("path",{...kt,x:{default:0},y:{default:0},width:{default:0,validate:Ee},height:{default:0,validate:Ee},pathPoints:{default:[]},pathArcParams:{default:[]},pathControlBounds:{default:null},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});Te.register("polyline",{...kt,x:{default:0},y:{default:0},width:{default:0,validate:Ee},height:{default:0,validate:Ee},polylinePoints:{default:[]},polylineClosed:{default:!1}});Te.register("triangle",{...nr,sides:{default:3}});Te.register("ngon",{...nr,sides:{default:6,validate:B_}});Te.register("star",{...nr,arms:{default:5,validate:V_},innerRadiusPercent:{default:40,validate:zt}});Te.register("cross",{...nr,armWidthPercent:{default:30,validate:zt}});Te.register("ring",{...nr,innerRadiusPercent:{default:50,validate:zt}});Te.register("spiral",{...nr,turns:{default:3,validate:j_},thicknessPercent:{default:15,validate:zt},spiralDirection:{default:1}});Te.register("gear",{...nr,teeth:{default:8,validate:G_},toothDepthPercent:{default:25,validate:zt},holeRadiusPercent:{default:20,validate:zt}});Te.register("arrow",{...nr,headWidthPercent:{default:100,validate:zt},headLengthPercent:{default:40,validate:zt},shaftWidthPercent:{default:40,validate:zt}});Te.register("symbol-instance",{...kt,x:{default:0},y:{default:0},width:{default:100,validate:Ee},height:{default:100,validate:Ee},symbolId:{default:""}});Te.register("group",{...kt});Te.register("container",{...kt});Te.register("cloud",{...nr,cloudBumps:{default:5},cloudPuffinessPercent:{default:60,validate:zt}});Te.register("heart",{...nr,lobeRadiusPercent:{default:50,validate:zt},cleftDepthPercent:{default:25,validate:zt}});Te.register("lightning",{...nr,boltSegments:{default:3},boltWidthPercent:{default:30,validate:zt},boltJaggednessPercent:{default:40,validate:zt}});Te.register("speechBubble",{...nr,tailAngleDeg:{default:45},tailLengthPercent:{default:40,validate:zt},tailWidthPercent:{default:25,validate:zt}});Te.register("diamond",{...Ts});Te.register("parallelogram",{...Ts,slantPercent:{default:20,validate:zt}});Te.register("trapezoid",{...Ts,topWidthPercent:{default:70,validate:zt}});Te.register("terminator",{...Ts});Te.register("cylinder",{...Ts,capHeightPercent:{default:15,validate:zt}});Te.register("document-shape",{...Ts,waveAmplitudePercent:{default:15,validate:zt}});Te.register("hyperlink",{...kt,href:{default:""},hrefXlink:{default:""},linkTarget:{default:""},linkPing:{default:""},linkRel:{default:""},linkHreflang:{default:""},linkType:{default:""},linkReferrerPolicy:{default:""}});Te.register("switch",{...kt,switchSystemLanguage:{default:null},switchRequiredExtensions:{default:null}});Te.register("svg",{...kt});Te.register("view",{...kt,viewBoxX:{default:0},viewBoxY:{default:0},viewBoxWidth:{default:0,validate:Ee},viewBoxHeight:{default:0,validate:Ee},viewName:{default:""},viewPreserveAspectRatio:{default:""},viewTarget:{default:""}});Te.register("shape-reference",{...kt,targetShapeId:{default:""},offsetX:{default:0},offsetY:{default:0},targetWidth:{default:0,validate:Ee},targetHeight:{default:0,validate:Ee},broken:{default:!1}});Te.register("foreign-object",{...kt,x:{default:0},y:{default:0},width:{default:0,validate:Ee},height:{default:0,validate:Ee},foreignContent:{default:[]}});Te.register("video",{...Ok,mediaKind:{default:"video"}});Te.register("audio",{...Ok,mediaKind:{default:"audio"}});Te.register("document",{});function sh(e){let t=new Set;for(let n of e??[])In(n,{onShape:r=>{r.id&&t.add(r.id)}});return t}function br(e){let t=sh(e.shapes),n=new Map;for(let i of e.library??[]){let o=new Set([i.id]);if(i.kind==="symbol"||i.kind==="marker")for(let s of sh(i.shapes))o.add(s);if(i.kind==="symbol")for(let s of Object.values(i.variants??{}))for(let a of sh(s))o.add(a);for(let s of o){let a=n.get(s)??new Set;a.add(i.id),n.set(s,a)}}let r=new Map;for(let[i,o]of n)r.set(i,Object.freeze([...o].sort()));return{documentParentIds:t,definitionIdsByParentId:r,resolve(i){if(i.parentDefinitionId!==void 0)return(r.get(i.parentId)??[]).includes(i.parentDefinitionId)?{kind:"library",definitionId:i.parentDefinitionId}:{kind:"missing"};if(t.has(i.parentId))return{kind:"document"};let o=r.get(i.parentId)??[];return o.length===1?{kind:"library",definitionId:o[0]}:o.length>1?{kind:"ambiguous",definitionIds:o}:{kind:"missing"}}}}var W_;function X_(){return W_??=new Set([...Te.typeIds().filter(e=>e!=="document"),"spline"])}function vo(e){let t=[],n=[];if(e==null||typeof e!="object")return t.push({path:"",message:"Snapshot must be a non-null object",severity:"error"}),{valid:!1,errors:t,warnings:n};let r=e;for(let o of Object.keys(r))o in pn||n.push({path:o,message:`Unknown top-level field "${o}" (likely written by a newer version); it is preserved in the unknownFields quarantine on save`,severity:"warning"});let i={doc:r,errors:t,warnings:n};for(let o of Object.keys(pn)){let s=r[o];s===void 0&&!pn[o].required||o1[o](s,i)}return Z_(r,t),{valid:t.length===0,errors:t,warnings:n}}function de(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Y_(e){let t=new Map,n=r=>{if(Array.isArray(r)){for(let i of r)if(!(!de(i)||!de(i.state))){if(typeof i.id=="string"&&i.type==="text"){let o=new Map,s=i.state.textSpanTree,a=c=>{if(Array.isArray(c))for(let l of c)de(l)&&(typeof l.spanId=="string"&&l.spanId.length>0&&o.set(l.spanId,{start:l.start,end:l.end}),a(l.children))};de(s)&&a(s.spans),t.set(i.id,o)}n(i.state.children)}}};return n(e),t}function jt(e,t,n){return Array.isArray(e)?!0:(n.push({path:t,message:`${t} must be an array`,severity:"error"}),!1)}function Rs(e,t,n){e!==void 0&&(typeof e!="number"||!Number.isInteger(e)||e<0)&&n.push({path:t,message:"Definition order must be a non-negative integer",severity:"error"})}function Cs(e,t,n){e!==void 0&&(typeof e!="string"||e.length===0)&&n.push({path:t,message:"Definition container id must be a non-empty string",severity:"error"})}function q_(e,t,n,r){if(e===void 0||!jt(e,t,r))return;let i=new Set;e.forEach((o,s)=>{let a=`${t}[${s}]`;if(!de(o)){r.push({path:a,message:"Animation track must be an object",severity:"error"});return}if(typeof o.id!="string"||o.id.length===0?r.push({path:`${a}.id`,message:"Animation track id must be a non-empty string",severity:"error"}):i.has(o.id)?r.push({path:`${a}.id`,message:`Duplicate animation track id: "${o.id}"`,severity:"error"}):i.add(o.id),(typeof o.shapeId!="string"||!n.has(o.shapeId))&&r.push({path:`${a}.shapeId`,message:"Definition animation must target a shape owned by the definition",severity:"error"}),!Array.isArray(o.keyframes)){r.push({path:`${a}.keyframes`,message:"Animation track keyframes must be an array",severity:"error"});return}let c=new Set;o.keyframes.forEach((l,d)=>{let u=`${a}.keyframes[${d}].id`;!de(l)||typeof l.id!="string"||!l.id?r.push({path:u,message:"Animation keyframe id must be a non-empty string",severity:"error"}):c.has(l.id)?r.push({path:u,message:`Duplicate animation keyframe id: "${l.id}"`,severity:"error"}):c.add(l.id)})})}function Z_(e,t){let n=new Set(Array.isArray(e.definitionContainers)?e.definitionContainers.flatMap(s=>de(s)&&typeof s.id=="string"?[s.id]:[]):[]),r=(s,a)=>{!de(s)||s.definitionContainerId===void 0||typeof s.definitionContainerId!="string"||s.definitionContainerId.length===0||n.has(s.definitionContainerId)||t.push({path:`${a}.definitionContainerId`,message:`Definition container "${s.definitionContainerId}" does not exist`,severity:"error"})};for(let[s,a]of[["documentExtensions",e.documentExtensions],["documentStyles",e.documentStyles],["library",e.library],["paintServerDefs",e.paintServerDefs],["clipMaskGroups",e.clipMaskGroups]])Array.isArray(a)&&a.forEach((c,l)=>r(c,`${s}[${l}]`));de(e.animationTimeline)&&Array.isArray(e.animationTimeline.tracks)&&e.animationTimeline.tracks.forEach((s,a)=>{if(!de(s)||s.sourceSmilDefinitionContainerId===void 0)return;let c=s.sourceSmilDefinitionContainerId;typeof c!="string"||c.length===0||n.has(c)||t.push({path:`animationTimeline.tracks[${a}].sourceSmilDefinitionContainerId`,message:`Definition container "${c}" does not exist`,severity:"error"})});let i=new Set(Array.isArray(e.library)?e.library.flatMap(s=>de(s)&&typeof s.id=="string"?[s.id]:[]):[]);Array.isArray(e.documentStyles)&&e.documentStyles.forEach((s,a)=>{!de(s)||s.scopeDefinitionId===void 0||typeof s.scopeDefinitionId!="string"||s.scopeDefinitionId.length===0||i.has(s.scopeDefinitionId)||t.push({path:`documentStyles[${a}].scopeDefinitionId`,message:`Scoped definition "${s.scopeDefinitionId}" does not exist`,severity:"error"})});let o=(s,a)=>{Array.isArray(s)&&s.forEach((c,l)=>{let d=`${a}[${l}]`;!de(c)||!de(c.state)||(r(c.state,`${d}.state`),o(c.state.children,`${d}.state.children`))})};o(e.shapes,"shapes"),Array.isArray(e.library)&&e.library.forEach((s,a)=>{de(s)&&o(s.shapes,`library[${a}].shapes`)})}var Q_=new Set(["text","comment","cdata","processing-instruction"]);function Mk(e,t,n){if(!de(e)){n.push({path:t,message:"Document extension attribute must be a plain object",severity:"error"});return}for(let r of["name","localName","value"])typeof e[r]!="string"&&n.push({path:`${t}.${r}`,message:`${r} must be a string`,severity:"error"});for(let r of["prefix","namespaceUri"])e[r]!==null&&typeof e[r]!="string"&&n.push({path:`${t}.${r}`,message:`${r} must be a string or null`,severity:"error"})}function zk(e,t,n){let r=[{node:e,path:t,depth:0}];for(;r.length>0;){let i=r.pop();if(i.depth>64){n.push({path:i.path,message:"Document extension nesting exceeds 64 levels",severity:"error"});continue}if(!de(i.node)){n.push({path:i.path,message:"Document extension node must be a plain object",severity:"error"});continue}let o=i.node;if(o.kind==="element"){for(let s of["name","localName"])(typeof o[s]!="string"||o[s].length===0)&&n.push({path:`${i.path}.${s}`,message:`${s} must be a non-empty string`,severity:"error"});for(let s of["prefix","namespaceUri"])o[s]!==null&&typeof o[s]!="string"&&n.push({path:`${i.path}.${s}`,message:`${s} must be a string or null`,severity:"error"});jt(o.attributes,`${i.path}.attributes`,n)&&o.attributes.forEach((s,a)=>Mk(s,`${i.path}.attributes[${a}]`,n)),jt(o.children,`${i.path}.children`,n)&&o.children.forEach((s,a)=>r.push({node:s,path:`${i.path}.children[${a}]`,depth:i.depth+1}));continue}Q_.has(String(o.kind))||n.push({path:`${i.path}.kind`,message:"Unsupported document extension node kind",severity:"error"}),typeof o.value!="string"&&n.push({path:`${i.path}.value`,message:"Document extension character value must be a string",severity:"error"})}}function J_(e,t,n,r){if(!de(e)){n.push({path:t,message:"Document extension must be a plain object",severity:"error"});return}typeof e.id!="string"||e.id.length===0?n.push({path:`${t}.id`,message:"Document extension id must be a non-empty string",severity:"error"}):r.has(e.id)?n.push({path:`${t}.id`,message:`Duplicate document extension id: "${e.id}"`,severity:"error"}):r.add(e.id),e.placement!=="root"&&e.placement!=="defs"&&n.push({path:`${t}.placement`,message:"Document extension placement must be root or defs",severity:"error"}),(typeof e.order!="number"||!Number.isInteger(e.order)||e.order<0)&&n.push({path:`${t}.order`,message:"Document extension order must be a non-negative integer",severity:"error"}),Rs(e.definitionOrder,`${t}.definitionOrder`,n),Cs(e.definitionContainerId,`${t}.definitionContainerId`,n),zk(e.element,`${t}.element`,n)}var e1=new Set(["x1","y1","x2","y2","gradientTransform"]),t1=new Set(["cx","cy","fx","fy","r","fr","gradientTransform"]),n1=new Set(["x","y","width","height"]);function wn(e,t,n){e.push({path:t,message:n,severity:"error"})}function r1(e,t,n,r){if(!de(e)){wn(r,t,"Gradient must be a plain object");return}if(e.templateId!==void 0&&typeof e.templateId!="string"&&wn(r,`${t}.templateId`,"templateId must be a string"),e.rootAttributes!==void 0)if(!de(e.rootAttributes))wn(r,`${t}.rootAttributes`,"Gradient rootAttributes must be a plain object");else for(let[o,s]of Object.entries(e.rootAttributes))Mi(o)||wn(r,`${t}.rootAttributes.${o}`,"Gradient root attributes must be safe non-typed attributes"),typeof s!="string"&&wn(r,`${t}.rootAttributes.${o}`,"Gradient root attribute values must be strings");let i=n==="linear-gradient"?["x1","y1","x2","y2","opacity"]:["cx","cy","fx","fy","r","ry","rotation","opacity"];for(let o of i)e[o]!==void 0&&(typeof e[o]!="number"||!Number.isFinite(e[o]))&&wn(r,`${t}.${o}`,`${o} must be a finite number`);if(e.fr!==void 0&&(typeof e.fr!="number"||!Number.isFinite(e.fr))&&wn(r,`${t}.fr`,"fr must be a finite number"),e.authoredGeometry!==void 0)if(!de(e.authoredGeometry))wn(r,`${t}.authoredGeometry`,"Gradient authoredGeometry must be a plain object");else{let o=n==="linear-gradient"?e1:t1;for(let[s,a]of Object.entries(e.authoredGeometry))o.has(s)?typeof a!="string"&&wn(r,`${t}.authoredGeometry.${s}`,"Authored gradient geometry declarations must be strings"):wn(r,`${t}.authoredGeometry.${s}`,"is not a supported authored gradient geometry field")}e.gradientTransform!==void 0&&(!Array.isArray(e.gradientTransform)||e.gradientTransform.length!==6||!e.gradientTransform.every(o=>typeof o=="number"&&Number.isFinite(o)))&&wn(r,`${t}.gradientTransform`,"gradientTransform must be a 6-element finite affine matrix"),Array.isArray(e.stops)?e.stops.forEach((o,s)=>{if(!de(o)){wn(r,`${t}.stops[${s}]`,"Gradient stop must be an object");return}o.id!==void 0&&(typeof o.id!="string"||o.id.length===0)&&wn(r,`${t}.stops[${s}].id`,"id must be a nonempty string");for(let a of["offset","opacity"])o[a]!==void 0&&(typeof o[a]!="number"||!Number.isFinite(o[a]))&&wn(r,`${t}.stops[${s}].${a}`,`${a} must be a finite number`)}):wn(r,`${t}.stops`,"Gradient stops must be an array")}function i1(e,t,n){if(!de(e)){n.push({path:t,message:"Pattern must be a plain object",severity:"error"});return}if(e.templateId!==void 0&&typeof e.templateId!="string"&&n.push({path:`${t}.templateId`,message:"templateId must be a string",severity:"error"}),e.rootAttributes!==void 0)if(!de(e.rootAttributes))n.push({path:`${t}.rootAttributes`,message:"Pattern rootAttributes must be a plain object",severity:"error"});else for(let[r,i]of Object.entries(e.rootAttributes))zi(r)||n.push({path:`${t}.rootAttributes.${r}`,message:"Pattern root attributes must be safe non-typed attributes",severity:"error"}),typeof i!="string"&&n.push({path:`${t}.rootAttributes.${r}`,message:"Pattern root attribute values must be strings",severity:"error"});for(let r of["x","y","width","height","scale","rotation","opacity"])e[r]!==void 0&&(typeof e[r]!="number"||!Number.isFinite(e[r]))&&n.push({path:`${t}.${r}`,message:`${r} must be a finite number`,severity:"error"});e.patternUnits!==void 0&&e.patternUnits!=="userSpaceOnUse"&&e.patternUnits!=="objectBoundingBox"&&n.push({path:`${t}.patternUnits`,message:"patternUnits must be userSpaceOnUse or objectBoundingBox",severity:"error"}),e.patternContentUnits!==void 0&&e.patternContentUnits!=="userSpaceOnUse"&&e.patternContentUnits!=="objectBoundingBox"&&n.push({path:`${t}.patternContentUnits`,message:"patternContentUnits must be userSpaceOnUse or objectBoundingBox",severity:"error"});for(let r of["svgContent","patternTransform","viewBox","preserveAspectRatio"])e[r]!==void 0&&typeof e[r]!="string"&&n.push({path:`${t}.${r}`,message:`${r} must be a string`,severity:"error"});if(e.authoredGeometry!==void 0)if(!de(e.authoredGeometry))n.push({path:`${t}.authoredGeometry`,message:"Pattern authoredGeometry must be a plain object",severity:"error"});else for(let[r,i]of Object.entries(e.authoredGeometry))n1.has(r)?typeof i!="string"&&n.push({path:`${t}.authoredGeometry.${r}`,message:"Authored pattern geometry declarations must be strings",severity:"error"}):n.push({path:`${t}.authoredGeometry.${r}`,message:"is not a supported authored pattern geometry field",severity:"error"})}var o1={schemaVersion:(e,{errors:t,warnings:n})=>{typeof e!="number"||!Number.isInteger(e)?t.push({path:"schemaVersion",message:"schemaVersion must be an integer",severity:"error"}):e>Tn&&n.push({path:"schemaVersion",message:`schemaVersion ${e} is newer than supported (${Tn})`,severity:"warning"})},shapes:(e,{errors:t,warnings:n})=>{if(!jt(e,"shapes",t))return;let r=new Set;e.forEach((i,o)=>{ch(i,`shapes[${o}]`,t,n,r)})},viewboxes:(e,{errors:t})=>{if(!jt(e,"viewboxes",t))return;let n=new Set;e.forEach((r,i)=>{p1(r,`viewboxes[${i}]`,t,n)})},guides:(e,{errors:t})=>{jt(e,"guides",t)&&e.forEach((n,r)=>{m1(n,`guides[${r}]`,t)})},measurements:(e,{errors:t})=>{jt(e,"measurements",t)&&e.forEach((n,r)=>{let i=`measurements[${r}]`;if(!de(n)){t.push({path:i,message:"Measurement must be a non-null object",severity:"error"});return}(typeof n.id!="string"||n.id.length===0)&&t.push({path:`${i}.id`,message:"Measurement id must be a non-empty string",severity:"error"})})},sceneTree:(e,{doc:t,errors:n,warnings:r})=>{if(!jt(e,"sceneTree",n))return;let i=ah(t.shapes),o=new Set;e.forEach((s,a)=>{s1(s,`sceneTree[${a}]`,n,r,i,o)})},clipMaskGroups:(e,{doc:t,errors:n,warnings:r})=>{if(!jt(e,"clipMaskGroups",n))return;let i=ah(t.shapes),o=br(t);e.forEach((s,a)=>{g1(s,`clipMaskGroups[${a}]`,n,r,i,o)})},documentMetadata:(e,{errors:t})=>{de(e)||t.push({path:"documentMetadata",message:"documentMetadata must be a plain object",severity:"error"})},documentExtensions:(e,{errors:t})=>{if(!jt(e,"documentExtensions",t))return;let n=new Set;e.forEach((r,i)=>J_(r,`documentExtensions[${i}]`,t,n))},definitionContainers:(e,{doc:t,errors:n})=>{if(!jt(e,"definitionContainers",n))return;let r=new Set,i=new Set,o=br(t);e.forEach((s,a)=>{let c=`definitionContainers[${a}]`;if(!de(s)){n.push({path:c,message:"Definition container must be a plain object",severity:"error"});return}typeof s.id!="string"||s.id.length===0?n.push({path:`${c}.id`,message:"Definition container id must be a non-empty string",severity:"error"}):r.has(s.id)?n.push({path:`${c}.id`,message:`Duplicate definition container id: "${s.id}"`,severity:"error"}):r.add(s.id),s.svgId!==void 0&&(typeof s.svgId!="string"||s.svgId.length===0)&&n.push({path:`${c}.svgId`,message:"Definition container svgId must be a non-empty string",severity:"error"}),typeof s.order!="number"||!Number.isInteger(s.order)||s.order<0?n.push({path:`${c}.order`,message:"Definition container order must be a non-negative integer",severity:"error"}):i.has(s.order)?n.push({path:`${c}.order`,message:`Duplicate definition container order: ${s.order}`,severity:"error"}):i.add(s.order),mc(s.authoredPlacement,`${c}.authoredPlacement`,n,o,"Definition container"),s.attributes!==void 0&&jt(s.attributes,`${c}.attributes`,n)&&s.attributes.forEach((l,d)=>{let u=`${c}.attributes[${d}]`;Mk(l,u,n),de(l)&&l.localName==="id"&&l.namespaceUri===null&&n.push({path:u,message:"Definition container attributes must not duplicate svgId authority",severity:"error"})})})},documentScripts:(e,{errors:t})=>{jt(e,"documentScripts",t)&&e.forEach((n,r)=>{let i=`documentScripts[${r}]`;if(!de(n)){t.push({path:i,message:"Document script must be a non-null object",severity:"error"});return}(typeof n.id!="string"||n.id.length===0)&&t.push({path:`${i}.id`,message:"Document script id must be a non-empty string",severity:"error"})})},documentStyles:(e,{doc:t,errors:n})=>{if(!jt(e,"documentStyles",n))return;let r=br(t);e.forEach((i,o)=>{let s=`documentStyles[${o}]`;if(!de(i)){n.push({path:s,message:"Document style must be a non-null object",severity:"error"});return}(typeof i.id!="string"||i.id.length===0)&&n.push({path:`${s}.id`,message:"Document style id must be a non-empty string",severity:"error"}),typeof i.css!="string"&&n.push({path:`${s}.css`,message:"Document style css must be a string",severity:"error"}),i.placement!=="root"&&i.placement!=="defs"&&n.push({path:`${s}.placement`,message:'Document style placement must be "root" or "defs"',severity:"error"}),Rs(i.definitionOrder,`${s}.definitionOrder`,n),Cs(i.definitionContainerId,`${s}.definitionContainerId`,n),mc(i.authoredPlacement,`${s}.authoredPlacement`,n,r,"Document style"),i.scopeDefinitionId!==void 0&&(typeof i.scopeDefinitionId!="string"||i.scopeDefinitionId.length===0)&&n.push({path:`${s}.scopeDefinitionId`,message:"Document style scopeDefinitionId must be a non-empty string",severity:"error"}),i.scopeDefinitionId!==void 0&&i.placement!=="defs"&&n.push({path:`${s}.scopeDefinitionId`,message:"A definition-scoped document style must use defs placement",severity:"error"})})},templateVariables:(e,{errors:t})=>{jt(e,"templateVariables",t)&&e.forEach((n,r)=>{let i=`templateVariables[${r}]`;if(!de(n)){t.push({path:i,message:"Template variable must be a non-null object",severity:"error"});return}(typeof n.name!="string"||n.name.length===0)&&t.push({path:`${i}.name`,message:"Template variable name must be a non-empty string",severity:"error"})})},animationTimeline:(e,{doc:t,errors:n})=>{if(!de(e)){n.push({path:"animationTimeline",message:"animationTimeline must be a plain object",severity:"error"});return}if(e.tracks!==void 0&&!Array.isArray(e.tracks)){n.push({path:"animationTimeline.tracks",message:"animationTimeline.tracks must be an array",severity:"error"});return}if(e.cssAnimationDocumentStylesFingerprint!==void 0&&(typeof e.cssAnimationDocumentStylesFingerprint!="string"||e.cssAnimationDocumentStylesFingerprint.length===0)&&n.push({path:"animationTimeline.cssAnimationDocumentStylesFingerprint",message:"CSS animation document-style fingerprint must be a non-empty string",severity:"error"}),e.cssAnimationInlineStylesFingerprint!==void 0&&(typeof e.cssAnimationInlineStylesFingerprint!="string"||e.cssAnimationInlineStylesFingerprint.length===0)&&n.push({path:"animationTimeline.cssAnimationInlineStylesFingerprint",message:"CSS animation inline-style fingerprint must be a non-empty string",severity:"error"}),e.cssAnimationSources!==void 0)if(!Array.isArray(e.cssAnimationSources))n.push({path:"animationTimeline.cssAnimationSources",message:"CSS animation sources must be an array",severity:"error"});else{let r=new Set,i=new Set;e.cssAnimationSources.forEach((o,s)=>{let a=`animationTimeline.cssAnimationSources[${s}]`;if(!de(o)){n.push({path:a,message:"CSS animation source must be an object",severity:"error"});return}if(typeof o.id!="string"||o.id.length===0?n.push({path:`${a}.id`,message:"CSS animation source id must be a non-empty string",severity:"error"}):r.has(o.id)?n.push({path:`${a}.id`,message:`Duplicate CSS animation source id: "${o.id}"`,severity:"error"}):r.add(o.id),!Array.isArray(o.trackIds)||!Array.isArray(o.trackFingerprints)){n.push({path:a,message:"CSS animation source track ids and fingerprints must be arrays",severity:"error"});return}o.trackIds.length!==o.trackFingerprints.length&&n.push({path:a,message:"CSS animation source track ids and fingerprints must have equal lengths",severity:"error"}),o.trackIds.forEach((c,l)=>{typeof c!="string"||c.length===0?n.push({path:`${a}.trackIds[${l}]`,message:"CSS animation source track id must be a non-empty string",severity:"error"}):i.has(c)?n.push({path:`${a}.trackIds[${l}]`,message:`Duplicate CSS animation source track id: "${c}"`,severity:"error"}):i.add(c)}),o.trackFingerprints.forEach((c,l)=>{(typeof c!="string"||c.length===0)&&n.push({path:`${a}.trackFingerprints[${l}]`,message:"CSS animation track fingerprint must be a non-empty string",severity:"error"})})})}if(Array.isArray(e.tracks)&&Number(t.schemaVersion)>=11){let r=Y_(t.shapes);e.tracks.forEach((i,o)=>{if(!de(i)||!Array.isArray(i.keyframes))return;if(i.sourceCssAnimationId!==void 0&&(typeof i.sourceCssAnimationId!="string"||!i.sourceCssAnimationId)&&n.push({path:`animationTimeline.tracks[${o}].sourceCssAnimationId`,message:"CSS animation source id must be a non-empty string",severity:"error"}),i.definitionTarget!==void 0){let a=`animationTimeline.tracks[${o}].definitionTarget`;if(!de(i.definitionTarget))n.push({path:a,message:"must be an object",severity:"error"});else{let c=i.definitionTarget.definitionId,l=i.definitionTarget.nodeId;if((typeof c!="string"||c.length===0)&&n.push({path:`${a}.definitionId`,message:"must be a non-empty string",severity:"error"}),l!==void 0&&(typeof l!="string"||l.length===0)&&n.push({path:`${a}.nodeId`,message:"must be a non-empty string when present",severity:"error"}),typeof c=="string"&&c.length>0){let d=`definition:${c}${typeof l=="string"&&l.length>0?`/${l}`:""}`;i.shapeId!==d&&n.push({path:`animationTimeline.tracks[${o}].shapeId`,message:`definition target tracks must use ${d}`,severity:"error"})}}}if(i.simpleDuration!==void 0&&i.simpleDuration!=="indefinite"&&n.push({path:`animationTimeline.tracks[${o}].simpleDuration`,message:'SMIL simple duration must be "indefinite" when present',severity:"error"}),i.simpleDuration==="indefinite"&&i.cycleDuration!==void 0&&n.push({path:`animationTimeline.tracks[${o}].cycleDuration`,message:"Finite and indefinite SMIL simple durations are mutually exclusive",severity:"error"}),i.sourceSmilPlacement!==void 0&&i.sourceSmilPlacement!=="document"&&i.sourceSmilPlacement!=="defs"&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilPlacement`,message:'SMIL source placement must be "document" or "defs" when present',severity:"error"}),i.sourceSmilParentTarget!==void 0&&i.sourceSmilParentTarget!==!0&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilParentTarget`,message:"SMIL implicit parent target must be true when present",severity:"error"}),i.sourceSmilParentTarget===!0&&i.sourceSmilPlacement!=="document"&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilPlacement`,message:"SMIL implicit parent target requires document placement",severity:"error"}),i.sourceSmilOrder!==void 0&&(!Number.isInteger(i.sourceSmilOrder)||Number(i.sourceSmilOrder)<0)&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilOrder`,message:"SMIL source order must be a non-negative integer when present",severity:"error"}),i.sourceSmilDefinitionOrder!==void 0&&(!Number.isInteger(i.sourceSmilDefinitionOrder)||Number(i.sourceSmilDefinitionOrder)<0)&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilDefinitionOrder`,message:"SMIL definition order must be a non-negative integer when present",severity:"error"}),i.sourceSmilDefinitionContainerId!==void 0&&(typeof i.sourceSmilDefinitionContainerId!="string"||i.sourceSmilDefinitionContainerId.length===0)&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilDefinitionContainerId`,message:"SMIL definition container id must be a non-empty string when present",severity:"error"}),(i.sourceSmilDefinitionOrder!==void 0||i.sourceSmilDefinitionContainerId!==void 0)&&i.sourceSmilPlacement!=="defs"&&n.push({path:`animationTimeline.tracks[${o}].sourceSmilPlacement`,message:'SMIL definition placement fields require sourceSmilPlacement "defs"',severity:"error"}),i.textPathStartOffsetUnit!==void 0&&i.textPathStartOffsetUnit!=="%"&&i.textPathStartOffsetUnit!=="user"&&n.push({path:`animationTimeline.tracks[${o}].textPathStartOffsetUnit`,message:'Text path start-offset unit must be "%" or "user" when present',severity:"error"}),i.textSpanTarget!==void 0){let a=`animationTimeline.tracks[${o}].textSpanTarget`;if(!de(i.textSpanTarget))n.push({path:a,message:"Text span target must be a plain object",severity:"error"});else{let c=i.textSpanTarget;if((typeof c.attributeName!="string"||c.attributeName.length===0)&&n.push({path:`${a}.attributeName`,message:"Text span target attribute name must be a non-empty string",severity:"error"}),!Array.isArray(c.spanIds)||c.spanIds.length===0||c.spanIds.some(l=>typeof l!="string"||l.length===0)||new Set(c.spanIds).size!==c.spanIds.length)n.push({path:`${a}.spanIds`,message:"Text span target ids must be unique non-empty strings",severity:"error"});else{let l=typeof i.shapeId=="string"?r.get(i.shapeId):void 0;if(!l)n.push({path:a,message:"Text span animation must target a canonical text shape",severity:"error"});else{c.spanIds.forEach((u,f)=>{l.has(u)||n.push({path:`${a}.spanIds[${f}]`,message:`Text span animation target "${u}" does not exist on shape "${i.shapeId}"`,severity:"error"})});let d=c.spanIds.map(u=>l.get(u));if(d.every(u=>u&&typeof u.start=="number"&&Number.isInteger(u.start)&&typeof u.end=="number"&&Number.isInteger(u.end))){let u=d[0].end;d.slice(1).every(p=>{let m=p;return m.start!==u?!1:(u=m.end,!0)})||n.push({path:`${a}.spanIds`,message:"Text span animation target ids must describe one ordered contiguous range",severity:"error"})}}}}}let s=new Set;i.keyframes.forEach((a,c)=>{let l=`animationTimeline.tracks[${o}].keyframes[${c}].id`;if(!de(a)||typeof a.id!="string"||!a.id){n.push({path:l,message:"Animation keyframe id must be a non-empty string",severity:"error"});return}if(s.has(a.id)){n.push({path:l,message:`Duplicate animation keyframe id: "${a.id}"`,severity:"error"});return}s.add(a.id)})})}},library:(e,{doc:t,errors:n,warnings:r})=>{if(!jt(e,"library",n))return;let i=new Set,o=br(t);e.forEach((c,l)=>{let d=`library[${l}]`;if(!de(c)){n.push({path:d,message:"Library def must be a non-null object",severity:"error"});return}if(typeof c.id!="string"||c.id.length===0?n.push({path:`${d}.id`,message:"Library def id must be a non-empty string",severity:"error"}):i.has(c.id)?n.push({path:`${d}.id`,message:`Duplicate library def id: "${c.id}"`,severity:"error"}):i.add(c.id),(typeof c.kind!="string"||c.kind.length===0)&&n.push({path:`${d}.kind`,message:"Library def kind must be a non-empty string",severity:"error"}),c.definitionPlacement!==void 0&&!["defs","document"].includes(String(c.definitionPlacement))&&n.push({path:`${d}.definitionPlacement`,message:"Library definitionPlacement must be defs or document",severity:"error"}),Rs(c.definitionOrder,`${d}.definitionOrder`,n),Cs(c.definitionContainerId,`${d}.definitionContainerId`,n),mc(c.authoredPlacement,`${d}.authoredPlacement`,n,o,"Library"),c.kind==="symbol"||c.kind==="marker"){let u=ah(c.shapes);if(typeof c.id=="string"&&c.id.length>0&&u.add(c.id),q_(c.animations,`${d}.animations`,u,n),c.kind==="symbol"){let f=typeof t.schemaVersion=="number"&&t.schemaVersion>=8;if(c.defKind!==void 0&&!["symbol","group","shape"].includes(String(c.defKind))&&n.push({path:`${d}.defKind`,message:"Symbol defKind must be symbol, group, or shape",severity:"error"}),c.definitionPlacement==="document"&&(c.defKind??"symbol")!=="symbol"&&n.push({path:`${d}.definitionPlacement`,message:"Only symbol roots may use document definition placement",severity:"error"}),c.defKind==="shape"&&(!Array.isArray(c.shapes)||c.shapes.length!==1)&&n.push({path:`${d}.shapes`,message:"Native shape definitions must contain exactly one root shape",severity:"error"}),f)for(let p of["wrapperAttrs","groups","overflow"])c[p]!==void 0&&n.push({path:`${d}.${p}`,message:`Symbol ${p} is schema-v7 migration input only`,severity:"error"});for(let p of["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"])c[p]!==void 0&&typeof c[p]!="string"&&n.push({path:`${d}.${p}`,message:`Symbol ${p} must be a string when present`,severity:"error"});if(c.rootAttributes!==void 0)if(!de(c.rootAttributes))n.push({path:`${d}.rootAttributes`,message:"Symbol rootAttributes must be a plain object",severity:"error"});else for(let[p,m]of Object.entries(c.rootAttributes))f&&["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(p)&&n.push({path:`${d}.rootAttributes.${p}`,message:`Symbol ${p} must use its typed root field`,severity:"error"}),typeof m!="string"&&n.push({path:`${d}.rootAttributes.${p}`,message:"Symbol root attribute values must be strings",severity:"error"});if(c.definitionContentOrder!==void 0)if(!Array.isArray(c.definitionContentOrder))n.push({path:`${d}.definitionContentOrder`,message:"Symbol definitionContentOrder must be an array",severity:"error"});else{let p=new Set(Array.isArray(c.shapes)?c.shapes.filter(g=>de(g)).map(g=>g.id).filter(g=>typeof g=="string"&&g.length>0):[]),m=new Set;c.definitionContentOrder.forEach((g,h)=>{let y=`${d}.definitionContentOrder[${h}]`;if(!de(g)){n.push({path:y,message:"Definition content entry must be a plain object",severity:"error"});return}if(g.kind!=="shape"&&g.kind!=="definition"&&n.push({path:`${y}.kind`,message:"Definition content kind must be shape or definition",severity:"error"}),typeof g.id!="string"||g.id.length===0){n.push({path:`${y}.id`,message:"Definition content id must be a non-empty string",severity:"error"});return}let S=`${String(g.kind)}\0${g.id}`;m.has(S)&&n.push({path:y,message:`Duplicate definition content entry: ${String(g.kind)} "${g.id}"`,severity:"error"}),m.add(S),g.kind==="shape"&&!p.has(g.id)&&n.push({path:`${y}.id`,message:`Definition content shape "${g.id}" is not a root shape of this definition`,severity:"error"})})}}if(c.kind==="marker"){for(let f of["viewBox","preserveAspectRatio"])c[f]!==void 0&&typeof c[f]!="string"&&n.push({path:`${d}.${f}`,message:`Marker ${f} must be a string when present`,severity:"error"});if(c.authoredGeometry!==void 0)if(!de(c.authoredGeometry))n.push({path:`${d}.authoredGeometry`,message:"Marker authoredGeometry must be a plain object",severity:"error"});else for(let[f,p]of Object.entries(c.authoredGeometry))typeof p!="string"&&n.push({path:`${d}.authoredGeometry.${f}`,message:"Marker authored geometry declarations must be strings",severity:"error"});if(c.rootAttributes!==void 0)if(!de(c.rootAttributes))n.push({path:`${d}.rootAttributes`,message:"Marker rootAttributes must be a plain object",severity:"error"});else for(let[f,p]of Object.entries(c.rootAttributes))["id","viewBox","preserveAspectRatio","refX","refY","markerWidth","markerHeight","markerUnits","orient"].includes(f)&&n.push({path:`${d}.rootAttributes.${f}`,message:`Marker ${f} must use its typed root field`,severity:"error"}),typeof p!="string"&&n.push({path:`${d}.rootAttributes.${f}`,message:"Marker root attribute values must be strings",severity:"error"})}if(Array.isArray(c.shapes)){let f=new Set;c.shapes.forEach((p,m)=>{ch(p,`${d}.shapes[${m}]`,n,r,f)})}if(c.kind==="symbol"&&de(c.variants))for(let[f,p]of Object.entries(c.variants)){if(!Array.isArray(p))continue;let m=new Set;p.forEach((g,h)=>{ch(g,`${d}.variants[${f}][${h}]`,n,r,m)})}}(c.kind==="linear-gradient"||c.kind==="radial-gradient")&&r1(c.gradient,`${d}.gradient`,c.kind,n),c.kind==="pattern"&&i1(c.pattern,`${d}.pattern`,n),c.kind==="appearance-style"&&c1(c.layers,`${d}.layers`,n)});let s=new Map;e.forEach((c,l)=>{de(c)&&c.kind==="symbol"&&typeof c.id=="string"&&c.id.length>0&&s.set(c.id,{def:c,index:l})});let a=new Map;for(let[c,{def:l,index:d}]of s)Array.isArray(l.definitionContentOrder)&&l.definitionContentOrder.forEach((u,f)=>{if(!de(u)||u.kind!=="definition"||typeof u.id!="string")return;let p=`library[${d}].definitionContentOrder[${f}].id`;if(u.id===c){n.push({path:p,message:`Symbol definition "${c}" cannot contain itself`,severity:"error"});return}if(!s.has(u.id)){n.push({path:p,message:`Nested symbol definition "${u.id}" does not exist`,severity:"error"});return}let m=a.get(u.id);if(m&&m!==c){n.push({path:p,message:`Nested symbol definition "${u.id}" already belongs to "${m}"`,severity:"error"});return}a.set(u.id,c)});for(let c of s.keys()){let l=new Set,d=c;for(;d!==void 0;){if(l.has(d)){let u=s.get(c);n.push({path:`library[${u?.index??0}].definitionContentOrder`,message:`Symbol definition forest contains a cycle through "${d}"`,severity:"error"});break}l.add(d),d=a.get(d)}}},paintServerDefs:(e,{doc:t,errors:n})=>{if(!jt(e,"paintServerDefs",n))return;let r=new Set,i=br(t);e.forEach((o,s)=>{l1(o,`paintServerDefs[${s}]`,n,r,i)})},colorGlyphLibrary:(e,{errors:t})=>{if(!de(e)){t.push({path:"colorGlyphLibrary",message:"colorGlyphLibrary must be a plain object",severity:"error"});return}e.version!==void 0&&!Number.isInteger(e.version)&&t.push({path:"colorGlyphLibrary.version",message:"colorGlyphLibrary.version must be an integer",severity:"error"}),e.entries!==void 0&&!Array.isArray(e.entries)&&t.push({path:"colorGlyphLibrary.entries",message:"colorGlyphLibrary.entries must be an array",severity:"error"})},exportItems:(e,{errors:t})=>{jt(e,"exportItems",t)&&e.forEach((n,r)=>{let i=`exportItems[${r}]`;if(!de(n)){t.push({path:i,message:"Export item must be a non-null object",severity:"error"});return}(typeof n.id!="string"||n.id.length===0)&&t.push({path:`${i}.id`,message:"Export item id must be a non-empty string",severity:"error"}),typeof n.filename!="string"&&t.push({path:`${i}.filename`,message:"Export item filename must be a string",severity:"error"}),typeof n.format!="string"&&t.push({path:`${i}.format`,message:"Export item format must be a string",severity:"error"})})},unknownFields:(e,{errors:t})=>{de(e)||t.push({path:"unknownFields",message:"unknownFields must be a plain object (forward-compat quarantine bag)",severity:"error"})}};function ah(e){let t=new Set;if(!Array.isArray(e))return t;for(let n of e)In(n,{onShape:r=>{typeof r.id=="string"&&r.id.length>0&&t.add(r.id)}});return t}function Dk(e){return e.startsWith("structural:")}function s1(e,t,n,r,i,o){if(e===null||typeof e!="object"){n.push({path:t,message:"Scene tree entry must be a non-null object",severity:"error"});return}let s=e;typeof s.id!="string"||s.id.length===0?n.push({path:`${t}.id`,message:"Scene tree id must be a non-empty string",severity:"error"}):(o.has(s.id)&&n.push({path:`${t}.id`,message:`Duplicate scene tree id: "${s.id}"`,severity:"error"}),o.add(s.id),!i.has(s.id)&&!Dk(s.id)&&r.push({path:`${t}.id`,message:`Scene tree id "${s.id}" is not present in shapes`,severity:"warning"})),s.parentId!==null&&typeof s.parentId!="string"?n.push({path:`${t}.parentId`,message:"Scene tree parentId must be a string or null",severity:"error"}):typeof s.parentId=="string"&&!i.has(s.parentId)&&!Dk(s.parentId)&&r.push({path:`${t}.parentId`,message:`Scene tree parentId "${s.parentId}" is not present in shapes`,severity:"warning"}),(typeof s.index!="number"||!Number.isInteger(s.index)||s.index<0)&&n.push({path:`${t}.index`,message:"Scene tree index must be a non-negative integer",severity:"error"}),s.updatedAt!==void 0&&(typeof s.updatedAt!="number"||!Number.isFinite(s.updatedAt)||s.updatedAt<0)&&n.push({path:`${t}.updatedAt`,message:"Scene tree updatedAt must be a non-negative finite number",severity:"error"}),s.clientId!==void 0&&typeof s.clientId!="string"&&n.push({path:`${t}.clientId`,message:"Scene tree clientId must be a string",severity:"error"})}var a1=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]);function mc(e,t,n,r,i){if(e===void 0)return;if(!de(e)){n.push({path:t,message:`${i} authoredPlacement must be an object`,severity:"error"});return}let o=e.parentId,s=e.parentDefinitionId,a=e.siblingIndex,c=!0;if((typeof o!="string"||o.length===0)&&(n.push({path:`${t}.parentId`,message:"Definition placement parentId must be a non-empty string",severity:"error"}),c=!1),s!==void 0&&(typeof s!="string"||s.length===0)&&(n.push({path:`${t}.parentDefinitionId`,message:"Definition placement parentDefinitionId must be a non-empty string when present",severity:"error"}),c=!1),c){let l=r.resolve(e);l.kind==="missing"?n.push({path:s===void 0?`${t}.parentId`:`${t}.parentDefinitionId`,message:s===void 0?`Definition placement parentId "${String(o)}" does not exist`:`Definition placement parent "${String(o)}" does not exist in library definition "${String(s)}"`,severity:"error"}):l.kind==="ambiguous"&&n.push({path:`${t}.parentId`,message:`Definition placement parentId "${String(o)}" is ambiguous across library definitions: ${l.definitionIds.join(", ")}`,severity:"error"})}(typeof a!="number"||!Number.isInteger(a)||a<0)&&n.push({path:`${t}.siblingIndex`,message:"Definition placement siblingIndex must be a non-negative integer",severity:"error"})}function c1(e,t,n){if(!Array.isArray(e)){n.push({path:t,message:"Appearance style layers must be an array",severity:"error"});return}let r=new Set;e.forEach((i,o)=>{let s=`${t}[${o}]`;if(!de(i)){n.push({path:s,message:"Appearance style layer must be an object",severity:"error"});return}if(i.kind!=="fill"&&i.kind!=="stroke"&&n.push({path:`${s}.kind`,message:"Appearance style layer kind must be fill or stroke",severity:"error"}),typeof i.id!="string"||i.id.length===0){n.push({path:`${s}.id`,message:"Appearance style layer id must be a non-empty string",severity:"error"});return}r.has(i.id)?n.push({path:`${s}.id`,message:`Duplicate appearance style layer id: "${i.id}"`,severity:"error"}):r.add(i.id)})}function l1(e,t,n,r,i){if(e===null||typeof e!="object"){n.push({path:t,message:"Paint server def must be a non-null object",severity:"error"});return}let o=e;typeof o.id!="string"||o.id.length===0?n.push({path:`${t}.id`,message:"Paint server def id must be a non-empty string",severity:"error"}):r.has(o.id)?n.push({path:`${t}.id`,message:`Duplicate paint server def id: "${o.id}"`,severity:"error"}):r.add(o.id),o.sourceId!==void 0&&(typeof o.sourceId!="string"||o.sourceId.length===0)&&n.push({path:`${t}.sourceId`,message:"Paint server def sourceId must be a non-empty string when present",severity:"error"});let s=o.role===void 0?"resource":o.role;s!=="resource"&&s!=="referenced-fragment"&&n.push({path:`${t}.role`,message:"Paint server def role must be resource or referenced-fragment",severity:"error"}),typeof o.type=="string"&&(s==="resource"&&a1.has(o.type)||s==="referenced-fragment"&&/^[A-Za-z][\w.-]*$/u.test(o.type))||n.push({path:`${t}.type`,message:"Paint server def type must be a supported SVG defs element type",severity:"error"}),(typeof o.markup!="string"||o.markup.length===0)&&n.push({path:`${t}.markup`,message:"Paint server def markup must be a non-empty string",severity:"error"}),o.passthrough!==void 0&&typeof o.passthrough!="boolean"&&n.push({path:`${t}.passthrough`,message:"Paint server def passthrough must be a boolean when present",severity:"error"});for(let c of["definitionChildIds","sourceDefinitionChildIds"]){let l=o[c];l!==void 0&&(!Array.isArray(l)||l.some(d=>typeof d!="string"||d.length===0))&&n.push({path:`${t}.${c}`,message:"Definition child ids must be non-empty strings",severity:"error"})}Array.isArray(o.definitionChildIds)&&Array.isArray(o.sourceDefinitionChildIds)&&o.definitionChildIds.length!==o.sourceDefinitionChildIds.length&&n.push({path:t,message:"Definition child id arrays must have equal lengths",severity:"error"}),mc(o.authoredPlacement,`${t}.authoredPlacement`,n,i,"Paint server def"),Rs(o.definitionOrder,`${t}.definitionOrder`,n),Cs(o.definitionContainerId,`${t}.definitionContainerId`,n)}function ch(e,t,n,r,i){if(e===null||typeof e!="object"||Array.isArray(e)){n.push({path:t,message:"Shape must be a non-null object",severity:"error"});return}In(e,{onShape:(o,s)=>{d1(o,`${t}${s}`,n,r,i)}})}function d1(e,t,n,r,i){if(typeof e.id!="string"||e.id.length===0?n.push({path:`${t}.id`,message:"Shape id must be a non-empty string",severity:"error"}):i.has(e.id)?n.push({path:`${t}.id`,message:`Duplicate shape id: "${e.id}"`,severity:"error"}):i.add(e.id),typeof e.type!="string"?n.push({path:`${t}.type`,message:"Shape type must be a string",severity:"error"}):X_().has(e.type)||r.push({path:`${t}.type`,message:`Unknown shape type: "${e.type}"`,severity:"warning"}),e.state===void 0||e.state===null||typeof e.state!="object")n.push({path:`${t}.state`,message:"Shape state must be a non-null object",severity:"error"});else{let o=e.state;f1(o,`${t}.state`,n,r),e.type==="foreign-object"&&(Object.hasOwn(o,"rawContent")&&n.push({path:`${t}.state.rawContent`,message:"rawContent is noncanonical; use structured foreignContent nodes",severity:"error"}),o.foreignContent!==void 0&&jt(o.foreignContent,`${t}.state.foreignContent`,n)&&o.foreignContent.forEach((s,a)=>zk(s,`${t}.state.foreignContent[${a}]`,n))),o.children!==void 0&&!Array.isArray(o.children)?n.push({path:`${t}.state.children`,message:"children must be an array",severity:"error"}):Array.isArray(o.children)&&o.children.forEach((s,a)=>{(s===null||typeof s!="object"||Array.isArray(s))&&n.push({path:`${t}.state.children[${a}]`,message:"Shape must be a non-null object",severity:"error"})})}}var u1=/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/;function $k(e){return typeof e=="number"?isFinite(e):typeof e=="string"?u1.test(e):!1}function f1(e,t,n,r){if(Rs(e.definitionOrder,`${t}.definitionOrder`,n),Cs(e.definitionContainerId,`${t}.definitionContainerId`,n),de(e.metadata))for(let s of["linkUrl","linkTarget"])Object.hasOwn(e.metadata,s)&&n.push({path:`${t}.metadata.${s}`,message:`${s} is noncanonical; use a Hyperlink container shape`,severity:"error"});if((e.fillType==="linear-gradient"||e.fillType==="radial-gradient"||e.fillType==="pattern")&&e.fillColor==="none"&&e.fillOpacity===0&&n.push({path:`${t}.fillOpacity`,message:"Painted shapes cannot carry the noncanonical no-fill opacity encoding",severity:"error"}),e.charOffsets!==void 0&&e.charOffsets!==null&&(Array.isArray(e.charOffsets)?e.charOffsets.forEach((s,a)=>{let c=`${t}.charOffsets[${a}]`;if(!de(s)){n.push({path:c,message:"Each charOffsets entry must be a plain object",severity:"error"});return}for(let l of["x","y"]){let d=s[l];d!==null&&(typeof d!="number"||!Number.isFinite(d))&&n.push({path:`${c}.${l}`,message:`${l} must be null or a finite number`,severity:"error"})}for(let l of["dx","dy","rotate"]){let d=s[l];(typeof d!="number"||!Number.isFinite(d))&&n.push({path:`${c}.${l}`,message:`${l} must be a finite number`,severity:"error"})}if(s.raw!==void 0)if(!de(s.raw))n.push({path:`${c}.raw`,message:"raw must be a plain object",severity:"error"});else for(let[l,d]of Object.entries(s.raw))(!["x","y","dx","dy"].includes(l)||typeof d!="string")&&n.push({path:`${c}.raw.${l}`,message:"raw accepts only string x/y/dx/dy members",severity:"error"})}):n.push({path:`${t}.charOffsets`,message:"charOffsets must be an array",severity:"error"})),e.textPathReference!==void 0&&e.textPathReference!==null){let s=e.textPathReference;(!de(s)||s.kind!=="shape"&&s.kind!=="definition"||typeof s.targetId!="string"||s.targetId.length===0||s.element!=="href"&&s.element!=="mpath"||Object.keys(s).some(a=>!["kind","targetId","element"].includes(a)))&&n.push({path:`${t}.textPathReference`,message:"textPathReference requires an exact shape/definition target and href/mpath element",severity:"error"})}for(let s of["textPathRefShapeId","textPathImportRefId"])e[s]!==void 0&&n.push({path:`${t}.${s}`,message:`${s} is noncanonical; use textPathReference`,severity:"error"});if(e.authoredTextPosition!==void 0)if(!de(e.authoredTextPosition))n.push({path:`${t}.authoredTextPosition`,message:"authoredTextPosition must be a plain object",severity:"error"});else for(let[s,a]of Object.entries(e.authoredTextPosition)){let c=`${t}.authoredTextPosition.${s}`;if(!["x","y"].includes(s)||!de(a)){n.push({path:c,message:"Authored text position accepts only x/y coordinate objects",severity:"error"});continue}(typeof a.raw!="string"||a.raw.length===0||typeof a.resolved!="number"||!Number.isFinite(a.resolved))&&n.push({path:c,message:"Authored text coordinates require non-empty raw and finite resolved values",severity:"error"});for(let l of Object.keys(a))["raw","resolved"].includes(l)||n.push({path:`${c}.${l}`,message:"Authored text coordinates accept only raw/resolved members",severity:"error"})}if(e.textSpanTree!==void 0){let s=`${t}.textSpanTree`;if(!de(e.textSpanTree))n.push({path:s,message:"textSpanTree must be a plain object",severity:"error"});else{let a=e.textSpanTree,c=a.text,l=a.spans;if(typeof c!="string"||!Array.isArray(l))n.push({path:s,message:"Text span trees require text and spans",severity:"error"});else{let d=new Set,u=(f,p,m,g)=>{let h=p;f.forEach((y,S)=>{let b=`${g}[${S}]`,I=de(y)?y.start:void 0,v=de(y)?y.end:void 0,w=de(y)?y.children:void 0,k=de(y)?y.spanId:void 0,C=de(y)?y.id:void 0,P=de(y)?y.lineIndex:void 0,R=de(y)?y.rotate:void 0;!de(y)||typeof I!="number"||typeof v!="number"||!Number.isInteger(I)||!Number.isInteger(v)||I<h||v<I||I<p||v>m||!Array.isArray(w)||typeof k!="string"||k.length===0||d.has(k)||C!==void 0&&(typeof C!="string"||C.length===0)||P!==void 0&&(typeof P!="number"||!Number.isInteger(P)||P<0)||R!==void 0&&(!Array.isArray(R)||R.length===0||R.some(N=>typeof N!="number"||!Number.isFinite(N)))||Object.keys(y).some(N=>!["spanId","start","end","id","lineIndex","rotate","children"].includes(N))?n.push({path:b,message:"Text span nodes require nested ordered ranges, child arrays, and valid optional identity/line fields",severity:"error"}):(d.add(k),u(w,I,v,`${b}.children`),h=v)})};u(l,0,c.length,`${s}.spans`),a.rotate!==void 0&&(!Array.isArray(a.rotate)||a.rotate.length===0||a.rotate.some(f=>typeof f!="number"||!Number.isFinite(f)))&&n.push({path:`${s}.rotate`,message:"Text span root rotate must be a non-empty finite number list",severity:"error"});for(let f of Object.keys(a))["text","rotate","spans"].includes(f)||n.push({path:`${s}.${f}`,message:"Text span trees accept only text/spans members",severity:"error"})}}}if(e.authoredUseGeometry!==void 0)if(!de(e.authoredUseGeometry))n.push({path:`${t}.authoredUseGeometry`,message:"authoredUseGeometry must be a plain object",severity:"error"});else for(let[s,a]of Object.entries(e.authoredUseGeometry))(!["x","y","width","height"].includes(s)||typeof a!="string")&&n.push({path:`${t}.authoredUseGeometry.${s}`,message:"Authored use geometry accepts only string x/y/width/height members",severity:"error"});let i=["x","y","width","height","radius","rx","ry","fontSize"];for(let s of i)e[s]!==void 0&&!$k(e[s])&&n.push({path:`${t}.${s}`,message:`${s} must be a finite number or a {{variable}} reference`,severity:"error"});for(let s of ul){let a=e[s];if(a!=null){if(s==="transformMatrix"){(!Array.isArray(a)||a.length<6||!a.slice(0,6).every(c=>typeof c=="number"&&Number.isFinite(c)))&&n.push({path:`${t}.${s}`,message:`${s} must be a 6-element finite affine matrix`,severity:"error"});continue}$k(a)||n.push({path:`${t}.${s}`,message:`${s} must be a finite number or a {{variable}} reference`,severity:"error"})}}let o=["width","height","radius","fontSize"];for(let s of o){let a=e[s];typeof a=="number"&&a<=0&&r.push({path:`${t}.${s}`,message:`${s} should be positive (got ${a})`,severity:"warning"})}}function p1(e,t,n,r){if(e===null||typeof e!="object"){n.push({path:t,message:"Viewbox must be a non-null object",severity:"error"});return}let i=e;typeof i.id!="string"||i.id.length===0?n.push({path:`${t}.id`,message:"Viewbox id must be a non-empty string",severity:"error"}):r.has(i.id)?n.push({path:`${t}.id`,message:`Duplicate viewbox id: "${i.id}"`,severity:"error"}):r.add(i.id);for(let o of["x","y","width","height"])(typeof i[o]!="number"||!isFinite(i[o]))&&n.push({path:`${t}.${o}`,message:`${o} must be a finite number`,severity:"error"});typeof i.width=="number"&&i.width<=0&&n.push({path:`${t}.width`,message:"Viewbox width must be positive",severity:"error"}),typeof i.height=="number"&&i.height<=0&&n.push({path:`${t}.height`,message:"Viewbox height must be positive",severity:"error"})}function m1(e,t,n){if(e===null||typeof e!="object"){n.push({path:t,message:"Guide must be a non-null object",severity:"error"});return}let r=e;(typeof r.id!="string"||r.id.length===0)&&n.push({path:`${t}.id`,message:"Guide id must be a non-empty string",severity:"error"}),r.orientation!=="horizontal"&&r.orientation!=="vertical"&&n.push({path:`${t}.orientation`,message:'Guide orientation must be "horizontal" or "vertical"',severity:"error"}),(typeof r.position!="number"||!isFinite(r.position))&&n.push({path:`${t}.position`,message:"Guide position must be a finite number",severity:"error"})}function g1(e,t,n,r,i,o){if(e===null||typeof e!="object"){n.push({path:t,message:"ClipMaskGroup must be a non-null object",severity:"error"});return}let s=e;(typeof s.id!="string"||s.id.length===0)&&n.push({path:`${t}.id`,message:"ClipMaskGroup id must be a non-empty string",severity:"error"}),s.type!=="clip"&&s.type!=="mask"&&n.push({path:`${t}.type`,message:'ClipMaskGroup type must be "clip" or "mask"',severity:"error"}),s.definitionPlacement!==void 0&&s.definitionPlacement!=="defs"&&s.definitionPlacement!=="document"&&n.push({path:`${t}.definitionPlacement`,message:'definitionPlacement must be "defs" or "document"',severity:"error"}),s.referenceChannel!==void 0&&s.referenceChannel!=="attribute"&&s.referenceChannel!=="style"&&s.referenceChannel!=="stylesheet"&&n.push({path:`${t}.referenceChannel`,message:'referenceChannel must be "attribute", "style", or "stylesheet"',severity:"error"}),s.referenceStyleOrder!==void 0&&(typeof s.referenceStyleOrder!="number"||!Number.isInteger(s.referenceStyleOrder)||s.referenceStyleOrder<0)&&n.push({path:`${t}.referenceStyleOrder`,message:"referenceStyleOrder must be a non-negative integer",severity:"error"}),Rs(s.definitionOrder,`${t}.definitionOrder`,n),Cs(s.definitionContainerId,`${t}.definitionContainerId`,n),mc(s.authoredPlacement,`${t}.authoredPlacement`,n,o,"Clip/mask");let a=s.clipShapeIds,c=typeof s.rawDefinition=="string"&&s.rawDefinition.length>0;a!==void 0&&!Array.isArray(a)?n.push({path:`${t}.clipShapeIds`,message:"clipShapeIds must be an array",severity:"error"}):a===void 0?n.push({path:`${t}.clipShapeIds`,message:"ClipMaskGroup must carry clipShapeIds",severity:"error"}):Array.isArray(a)&&a.length===0&&!c&&r.push({path:`${t}.clipShapeIds`,message:"ClipMaskGroup has no clip shapes and no rawDefinition; it will clip nothing",severity:"warning"}),Array.isArray(s.contentShapeIds)||n.push({path:`${t}.contentShapeIds`,message:"contentShapeIds must be an array",severity:"error"})}function on(e){let t=[...e].sort((i,o)=>i.index-o.index);if(!t.some(i=>i.orderKey))return t;let n=Uf(t.length),r=new Map;return t.forEach((i,o)=>{r.set(i.id,i.orderKey??n[o])}),t.sort((i,o)=>{let s=gl(r.get(i.id)??"",r.get(o.id)??"");return s!==0?s:i.id<o.id?-1:i.id>o.id?1:0})}function Ut(e){return e.definitionId??`${e.type}-${e.id}`}function lh(e){return e.rawDefinition!==void 0?!0:e.clipShapeIds.length===0}function dh(e){let t=lh(e);return e.type==="clip"?{type:"clip",...e.definitionPlacement!==void 0?{definitionPlacement:e.definitionPlacement}:{},...e.definitionOrder!==void 0?{definitionOrder:e.definitionOrder}:{},...e.definitionContainerId!==void 0?{definitionContainerId:e.definitionContainerId}:{},...e.authoredPlacement!==void 0?{authoredPlacement:structuredClone(e.authoredPlacement)}:{},...e.clipPathUnits!==void 0?{clipPathUnits:e.clipPathUnits}:{},...!t&&e.clipRule!==void 0?{clipRule:e.clipRule}:{},...t&&e.rawDefinition!==void 0?{rawDefinition:e.rawDefinition}:{}}:{type:"mask",...e.definitionPlacement!==void 0?{definitionPlacement:e.definitionPlacement}:{},...e.definitionOrder!==void 0?{definitionOrder:e.definitionOrder}:{},...e.definitionContainerId!==void 0?{definitionContainerId:e.definitionContainerId}:{},...e.authoredPlacement!==void 0?{authoredPlacement:structuredClone(e.authoredPlacement)}:{},...e.maskUnits!==void 0?{maskUnits:e.maskUnits}:{},...e.maskContentUnits!==void 0?{maskContentUnits:e.maskContentUnits}:{},...e.maskType!==void 0?{maskType:e.maskType}:{},...e.maskBounds!==void 0?{maskBounds:structuredClone(e.maskBounds)}:{},...t&&e.rawDefinition!==void 0?{rawDefinition:e.rawDefinition}:{}}}function As(e,t,n){let{clipPathUnits:r,clipRule:i,maskUnits:o,maskContentUnits:s,maskType:a,maskBounds:c,definitionPlacement:l,definitionOrder:d,definitionContainerId:u,authoredPlacement:f,rawDefinition:p,...m}=structuredClone(e),g=t.rawDefinition!==void 0||lh(e);return e.type==="clip"?{...m,type:"clip",...t.definitionPlacement!==void 0?{definitionPlacement:t.definitionPlacement}:{},...t.definitionOrder!==void 0?{definitionOrder:t.definitionOrder}:{},...t.definitionContainerId!==void 0?{definitionContainerId:t.definitionContainerId}:{},...t.authoredPlacement!==void 0?{authoredPlacement:structuredClone(t.authoredPlacement)}:{},...t.clipPathUnits!==void 0?{clipPathUnits:t.clipPathUnits}:{},...!g&&t.clipRule!==void 0?{clipRule:t.clipRule}:{},...g&&n&&t.rawDefinition!==void 0?{rawDefinition:t.rawDefinition}:{}}:{...m,type:"mask",...t.definitionPlacement!==void 0?{definitionPlacement:t.definitionPlacement}:{},...t.definitionOrder!==void 0?{definitionOrder:t.definitionOrder}:{},...t.definitionContainerId!==void 0?{definitionContainerId:t.definitionContainerId}:{},...t.authoredPlacement!==void 0?{authoredPlacement:structuredClone(t.authoredPlacement)}:{},...t.maskUnits!==void 0?{maskUnits:t.maskUnits}:{},...t.maskContentUnits!==void 0?{maskContentUnits:t.maskContentUnits}:{},...t.maskType!==void 0?{maskType:t.maskType}:{},...t.maskBounds!==void 0?{maskBounds:structuredClone(t.maskBounds)}:{},...g&&n&&t.rawDefinition!==void 0?{rawDefinition:t.rawDefinition}:{}}}function ui(e){let t=new Map;for(let n of e??[]){let r=Ut(n),i=dh(n),o=t.get(r);t.set(r,o?.type===i.type?{...o,...i}:i)}return t}function rr(e){let t=structuredClone(e??[]),n=ui(t),r=new Set;return t.map(i=>{let o=Ut(i),s=n.get(o)??dh(i),a=s.rawDefinition!==void 0&&!r.has(o);return a&&r.add(o),As(i,s,a)})}function Bi(e,t){let n=structuredClone(e??[]);if(t.type==="clipMask:remove"){let c=n.find(p=>p.id===t.id);if(!c)return rr(n);let l=Ut(c),d=ui(n).get(l),u=n.filter(p=>p.id!==t.id),f=u.findIndex(p=>Ut(p)===l);return d&&f>=0&&(u[f]=As(u[f],d,!0)),rr(u)}let r=n.findIndex(c=>c.id===t.clipMaskGroup.id),i=r>=0?n[r]:void 0,o=i?ui(n).get(Ut(i)):void 0;r>=0&&n.splice(r,1);let s=Math.min(Math.max(0,t.index??n.length),n.length),a=structuredClone(t.clipMaskGroup);return o?.rawDefinition!==void 0&&a.rawDefinition===void 0&&Ut(i)===Ut(a)&&(a=As(a,o,!0)),n.splice(s,0,a),rr(n)}function uh(e,t,n,r){if(!e.some(o=>o.id===t))throw new Error(`Unknown clip/mask group: ${t}`);let i=e.map(o=>o.id===t?As({...o,definitionId:n},r,r.rawDefinition!==void 0):Ut(o)!==n?structuredClone(o):As(o,r,!1));return rr(i)}var h1=/^structural:(clip|mask):(.+):(group|path|content)$/;function Fk(e,t){let n=`structural:${e}:${t}`;return{group:`${n}:group`,path:`${n}:path`,content:`${n}:content`}}function Lk(e,t){for(let n of e){t.add(n.id);let r=n.state.children;Array.isArray(r)&&Lk(r,t)}}function _k(e,t=null){let n=[];return e.forEach((r,i)=>{n.push({id:r.id,parentId:t,index:i});let o=r.state.children;Array.isArray(o)&&n.push(..._k(o,r.id))}),n}function jr(e){let t=e.sceneTree&&e.sceneTree.length>0?e.sceneTree:_k(e.shapes),n=new Map(t.map(v=>[v.id,v])),r=new Map;for(let v of t){let w=r.get(v.parentId)??[];w.push(v),r.set(v.parentId,w)}for(let[v,w]of r)r.set(v,on(w));let i=v=>h1.test(v),o=new Set(t.filter(v=>!i(v.id)).map(v=>v.id)),s=new Set;Lk(e.shapes,s);let a=new Map,c=new Set,l=(v,w)=>{let k=[];for(let C of r.get(v)??[]){if(!i(C.id)){c.has(C.id)||(c.add(C.id),k.push(C.id));continue}if(w.has(C.id))continue;let P=new Set(w);P.add(C.id),k.push(...l(C.id,P))}return k},d=[null,...o];for(let v of d){let w=l(v,new Set);w.length>0&&a.set(v,w)}for(let v of o){if(c.has(v))continue;let w=n.get(v)?.parentId??null,k=w!==null&&o.has(w)?w:null,C=a.get(k)??[];C.push(v),a.set(k,C),c.add(v)}let u=v=>{for(let[w,k]of a){let C=k.indexOf(v);if(C>=0)return{parentId:w,index:C}}return null},f=v=>{for(let w of a.values()){let k=w.indexOf(v);k>=0&&w.splice(k,1)}},p=e.clipMaskGroups??[],m=ui(p),g=new Set(p.filter(v=>v.clipShapeIds.some(w=>s.has(w))).map(v=>`${v.type}\0${Ut(v)}`)),h=new Map(p.map(v=>[Fk(v.type,v.id).content,v])),y=(v,w=new Set)=>{if(w.has(v.id))return Number.MAX_SAFE_INTEGER;let k=v.parentId?h.get(v.parentId):void 0;if(!k)return 0;let C=new Set(w);return C.add(v.id),1+y(k,C)},S=[...p].sort((v,w)=>y(v)-y(w)||(v.siblingIndex??0)-(w.siblingIndex??0)),b=new Map;for(let v of S){let w=v.clipShapeIds.filter(W=>s.has(W)),k=v.contentShapeIds.filter(W=>s.has(W)),C=Ut(v),R=m.get(C)?.rawDefinition!==void 0||g.has(`${v.type}\0${C}`);if(k.length===0||!R)continue;let N=[...k,...w].map(u).filter(W=>W!==null),M=N[0]?.parentId??null,A=N.length>0?Math.min(...N.map(W=>W.index)):void 0,$=v.parentId===null||o.has(v.parentId)||h.has(v.parentId)?v.parentId:M;for(let W of[...w,...k])f(W);let _=Fk(v.type,v.id),z=a.get($)??[],j=v.siblingIndex??A??z.length,G=Math.min(Math.max(0,j),z.length);z.splice(G,0,_.group),a.set($,z),a.set(_.group,[_.path,_.content]),a.set(_.path,[...w]),a.set(_.content,[...k]),b.set(_.group,{id:_.group,parentId:$,index:0}),b.set(_.path,{id:_.path,parentId:_.group,index:0}),b.set(_.content,{id:_.content,parentId:_.group,index:1})}let I=[];for(let[v,w]of a)w.forEach((k,C)=>{let P=b.get(k);if(P){I.push({...P,parentId:v,index:C});return}let R=n.get(k);R&&R.parentId===v?I.push({...R,index:C}):I.push({id:k,parentId:v,index:C})});e.sceneTree=I}function ir(e){let t=[],n=new Map,r=new Set,i=new WeakSet,o=[...e].reverse();for(;o.length>0;){let a=o.pop();if(!a||typeof a!="object"||i.has(a))continue;i.add(a),t.push(a);let c=n.get(a.id);c&&c!==a?r.add(a.id):c||n.set(a.id,a);let l=a.state.children;if(Array.isArray(l))for(let d=l.length-1;d>=0;d--){let u=l[d];u&&typeof u=="object"&&typeof u.id=="string"&&o.push(u)}}let s=new Map(n);for(let a of r)s.delete(a);return{ordered:t,uniqueById:s,duplicateIds:r}}function Vi(e){let t=[...e??[]],n=new Map;for(let o of t)n.set(o.id,(n.get(o.id)??0)+1);let r=new Set([...n].filter(([,o])=>o>1).map(([o])=>o)),i=new Map;for(let o of t)r.has(o.id)||i.set(o.id,o);return{ordered:t,uniqueById:i,duplicateIds:r,definition:o=>i.get(o),symbol:o=>{let s=i.get(o);return s?.kind==="symbol"?s:void 0}}}function y1(e){let t=e.groupData;if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t.transform;return typeof n=="string"&&n.trim()?n:null}function gc(e,t){let n=fn(e,t);if(n)return{matrix:ur(e,t),attribute:n,owner:"canonical"};let r=y1(e);if(r){let i=Rn(r),o=e.customPivot;return{matrix:o?Ol(o,i):i,attribute:r,owner:"group-data"}}return{matrix:Ke,attribute:null,owner:"none"}}function An(e){let t=e.transformMatrix;return xi(t)&&!un(t)||e.customPivot||typeof e.rawTransform=="string"&&e.rawTransform?!1:(e.rotation??0)!==0||(e.skewX??0)!==0||(e.skewY??0)!==0||(e.scaleX??1)!==1||(e.scaleY??1)!==1}function fu(e,t){let n=t?{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}:void 0;return gc(e,n)}var S1=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,b1=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)px$/i,v1=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)%$/;function hc(e,t,n,r){let i=e.trim();if(S1.test(i))return Number(i);let o=b1.exec(i);if(o)return Number(o[1]);let s=v1.exec(i);if(s)return t.percentBasis===void 0?(r.push({code:"unresolved-symbol-viewport",message:`Symbol ${t.axis} percentage ${e} needs a containing viewport basis.`}),null):Number(s[1])/100*t.percentBasis;let a=n.resolveLength?.(e,t)??null;return a!==null&&Number.isFinite(a)?a:(r.push({code:"invalid-symbol-length",message:`Symbol ${t.axis} length ${e} is invalid or requires an unavailable length host.`}),null)}function x1(e){let t=e.state.authoredUseGeometry;return t&&typeof t=="object"?t:{}}function xo(e,t){let n=e[t];if(typeof n=="string")return n;if(["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(t))return;let r=e.rootAttributes?.[t];return typeof r=="string"?r:void 0}function I1(e,t){if(e===void 0)return;let n=Mt(e);return n?n.width<0||n.height<0?(t.push({code:"invalid-symbol-viewbox",message:`Symbol viewBox ${e} has a non-finite or negative dimension and is ignored.`}),null):n:(t.push({code:"invalid-symbol-viewbox",message:`Symbol viewBox ${e} is not four finite SVG numbers and is ignored.`}),null)}function Bk(e,t,n,r,i,o){return t===void 0?0:hc(t,{axis:n,percentBasis:n==="x"?r?.width:r?.height},i,o)??0}function Vk(e,t,n,r,i,o,s){let a=n==="width"?i?.width:i?.height,c=[r,xo(t,n)];for(let l of c){if(l===void 0||l.trim().toLowerCase()==="auto")continue;let d=hc(l,{axis:n,percentBasis:a},o,s);if(d!==null){if(d<0){s.push({code:"invalid-symbol-length",message:`Negative symbol ${n} ${l} is invalid and falls back to auto.`});continue}return d}}return a!==void 0?a:(s.push({code:"unresolved-symbol-viewport",message:`Symbol ${n} is auto and needs a containing viewport basis.`}),null)}function Gk(e,t,n,r,i){if(e===void 0)return;let o=e.trim();if(t==="refX"){if(o==="left")return 0;if(o==="center")return(n?.width??0)/2;if(o==="right")return n?.width??0}else{if(o==="top")return 0;if(o==="center")return(n?.height??0)/2;if(o==="bottom")return n?.height??0}return hc(e,{axis:t,percentBasis:t==="refX"?n?.width:n?.height},r,i)??void 0}function yc(e,t,n,r={}){let i=[],o=x1(e),s=Bk(e,o.x,"x",n,r,i),a=Bk(e,o.y,"y",n,r,i),c=ft(s,a),l=xo(t,"transform"),d=l?Rn(l):Ke;if((t.defKind??"symbol")!=="symbol")return{kind:"group",renders:!0,useX:s,useY:a,useAttributes:o,contentMatrix:Ie(c,d),childPercentBasis:n??null,viewport:null,diagnostics:i};let u=Vk(e,t,"width",o.width,n,r,i),f=Vk(e,t,"height",o.height,n,r,i),p=xo(t,"x"),m=xo(t,"y"),g=p!==void 0?hc(p,{axis:"x",percentBasis:n?.width},r,i)??0:0,h=m!==void 0?hc(m,{axis:"y",percentBasis:n?.height},r,i)??0:0,y=I1(t.viewBox,i),S=ss({width:u,height:f,...y?{viewBoxX:y.x,viewBoxY:y.y,viewBoxWidth:y.width,viewBoxHeight:y.height}:{},preserveAspectRatio:xo(t,"preserveAspectRatio")},n);for(let C of S.diagnostics)i.push({code:C.code==="unresolved-viewport-size"?"unresolved-symbol-viewport":"invalid-symbol-viewbox",message:C.message.replace("Nested SVG","Symbol")});if(u===null||f===null||!S.renders||!S.contentMatrix)return{kind:"symbol",renders:!1,useX:s,useY:a,useAttributes:o,contentMatrix:Ie(c,d),childPercentBasis:S.childPercentBasis,viewport:S,diagnostics:i};let b=Gk(xo(t,"refX"),"refX",S.childPercentBasis,r,i),I=Gk(xo(t,"refY"),"refY",S.childPercentBasis,r,i),v=qe(S.contentMatrix,{x:b??0,y:I??0}),w=ft(g-(b===void 0?0:v.x),h-(I===void 0?0:v.y)),k=Ie(Ie(Ie(c,d),w),S.contentMatrix);return{kind:"symbol",renders:!0,useX:s,useY:a,useAttributes:o,contentMatrix:k,childPercentBasis:S.childPercentBasis,viewport:S,diagnostics:i}}function pu(){return{bounds:null,status:"empty",diagnostics:[]}}function Es(e,t,n){return n.resolveOwnTransform?.(e,t)??t}function xr(e,t){return{bounds:null,status:e,diagnostics:[t]}}function Sc(e,t){return e?t?{minX:Math.min(e.minX,t.minX),minY:Math.min(e.minY,t.minY),maxX:Math.max(e.maxX,t.maxX),maxY:Math.max(e.maxY,t.maxY)}:e:t}function vr(e,t,n="empty"){return e?{bounds:e,status:"resolved",diagnostics:t}:t.some(r=>r.code==="container-cycle"||r.code==="reference-cycle"||r.code==="symbol-cycle")?{bounds:null,status:"cycle",diagnostics:t}:t.some(r=>r.code==="unsupported-shape"||r.code==="deferred-tree-kind")?{bounds:null,status:"unsupported",diagnostics:t}:t.some(r=>r.code==="unresolved-shape"||r.code==="unresolved-reference-target"||r.code==="unresolved-reference-pivot"||r.code==="duplicate-shape-id"||r.code==="unresolved-svg-viewport"||r.code==="unresolved-symbol-definition"||r.code==="duplicate-library-id"||r.code==="unresolved-symbol-viewport"||r.code==="unresolved-symbol-pivot")?{bounds:null,status:"unresolved",diagnostics:t}:{bounds:null,status:n,diagnostics:t}}function mh(e){if(e.length===0)return null;let t=e[0].x,n=e[0].y,r=e[0].x,i=e[0].y;for(let o=1;o<e.length;o++){let s=e[o];t=Math.min(t,s.x),n=Math.min(n,s.y),r=Math.max(r,s.x),i=Math.max(i,s.y)}return{minX:t,minY:n,maxX:r,maxY:i}}function yh(e,t){return mh([qe(t,{x:e.minX,y:e.minY}),qe(t,{x:e.maxX,y:e.minY}),qe(t,{x:e.maxX,y:e.maxY}),qe(t,{x:e.minX,y:e.maxY})])}function jk(e,t,n,r,i){return n<0||r<0?null:yh({minX:e,minY:t,maxX:e+n,maxY:t+r},i)}function Uk(e,t,n,r,i){if(n<0||r<0)return null;let o=qe(i,{x:e,y:t}),s=Math.hypot(i[0]*n,i[2]*r),a=Math.hypot(i[1]*n,i[3]*r);return{minX:o.x-s,minY:o.y-a,maxX:o.x+s,maxY:o.y+a}}function w1(e,t){let n=Array.isArray(e)?e:[e],r=null;for(let i of n)r=Sc(r,yh(i,t));return r}function fh(e,t,n){return xr("unsupported",{code:t,shapeId:e.id,message:`Object bounds for ${n} require a document resolver policy.`,path:[e.id]})}function k1(e,t,n={}){return gh(e,Jn(e),t,n)}function gh(e,t,n,r){if(!t)return xr("unsupported",{code:"unsupported-shape",shapeId:e.id,message:`No geometry kernel is registered for shape type ${e.type}.`,path:[e.id]});let i;switch(t.kind){case"circle":i=Uk(t.cx,t.cy,t.r,t.r,n);break;case"ellipse":i=Uk(t.cx,t.cy,t.rx,t.ry,n);break;case"rectangle":if(t.width<0||t.height<0)i=null;else if(t.pathData)i=mr(t.pathData,n);else if(t.rx>0&&t.ry>0){let o=Dm(t.x,t.y,t.width,t.height,t.rx,t.ry);i=o?mr(o,n):null}else i=jk(t.x,t.y,t.width,t.height,n);break;case"line":if(t.boundsPolicy==="linked-line")return fh(e,"deferred-tree-kind","linked line");i=mh([qe(n,{x:t.x1,y:t.y1}),qe(n,{x:t.x2,y:t.y2})]);break;case"text":{let o=r.measureText?.(e,t)??null;if(!o)return fh(e,"deferred-tree-kind","text");i=w1(o,n);break}case"path":{if(t.boundsPolicy==="empty")return pu();let o=t.placement?Ie(n,ft(t.placement.x,t.placement.y)):n;i=Dp(t,o);break}case"polyline":{let o=t.points.length>0?t.points:[{x:0,y:0}];i=mh(o.map(s=>qe(n,s)));break}case"positioning-rect":i=jk(t.x,t.y,t.width,t.height,n);break;case"view":return pu();case"container":case"embedded-svg":case"shape-reference":case"symbol-instance":return fh(e,"deferred-tree-kind",t.kind)}return i?{bounds:i,status:"resolved",diagnostics:[]}:{bounds:null,status:"empty",diagnostics:[]}}function hh(e){let t=e.state.children;return Array.isArray(t)?t.filter(n=>!!n&&typeof n=="object"&&typeof n.id=="string"):[]}function Ur(e){let t=ir(e.shapes),n=Vi(e.library),r=e.sceneTree??[];if(r.length===0)return{roots:()=>e.shapes,shape:l=>t.uniqueById.get(l),duplicateShapeIds:()=>t.duplicateIds,libraryDefinition:l=>n.definition(l),duplicateLibraryIds:()=>n.duplicateIds,children:hh};let i=new Map,o=new Set;for(let l of r){let d=i.get(l.parentId)??[];i.set(l.parentId,[...d,l]),t.uniqueById.has(l.id)&&o.add(l.id)}let s=l=>{let d=[],u=new Set,f=p=>{for(let m of on([...i.get(p)??[]])){let g=t.uniqueById.get(m.id);if(g){d.push(g);continue}u.has(m.id)||(u.add(m.id),f(m.id),u.delete(m.id))}};return f(l),d};return{roots:()=>[...s(null),...e.shapes.filter(l=>!o.has(l.id))],shape:l=>t.uniqueById.get(l),duplicateShapeIds:()=>t.duplicateIds,libraryDefinition:l=>n.definition(l),duplicateLibraryIds:()=>n.duplicateIds,children:l=>[...s(l.id),...hh(l).filter(d=>!o.has(d.id))]}}function Hk(e,t){return`${t.identityPrefixes.at(-1)??"document"}\0${e.id}`}var P1=new Set(["block","contents","flex","flow","flow-root","grid","inherit","initial","inline","inline-block","inline-flex","inline-grid","inline-table","list-item","none","revert","revert-layer","ruby","ruby-base","ruby-base-container","ruby-text","ruby-text-container","run-in","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","unset"]),ph=new Set(["block","inline","run-in"]),T1=new Set(["flow","flow-root","table","flex","grid","ruby"]);function R1(e){let t=e.trim().toLowerCase();if(P1.has(t)||/^(?:var|env)\(/.test(t)&&t.endsWith(")"))return!0;let n=t.split(/\s+/);if(n.length<2||n.length>3||new Set(n).size!==n.length)return!1;if(n.includes("list-item")){let r=n.filter(i=>i!=="list-item");return r.filter(i=>ph.has(i)).length<=1&&r.filter(i=>i==="flow"||i==="flow-root").length<=1&&r.every(i=>ph.has(i)||i==="flow"||i==="flow-root")}return n.length===2&&n.some(r=>ph.has(r))&&n.some(r=>T1.has(r))}function C1(e){if(!e)return null;let t=null;for(let n of Dr(e,";")){let r=Dr(n,":");if(r.length<2||r[0].trim().toLowerCase()!=="display")continue;let i=r.slice(1).join(":").trim(),o=/\s*!important\s*$/i.test(i),s=i.replace(/\s*!important\s*$/i,"").trim().toLowerCase();R1(s)&&(!t||o||!t.important)&&(t={value:s,important:o})}return t}function Kk(e,t){let n=C1(typeof t=="string"?t:void 0);return n?n.value!=="none":typeof e!="string"||e.trim().toLowerCase()!=="none"}function bc(e,t){if(e.state.visible===!1)return!1;let n=e.type==="symbol-instance"||e.type==="shape-reference"?e.state.instancePresentation:void 0,r=n?.display??e.state.display;return Kk(r,n?.style)?t.participatesInRendering?.(e)??!0:!1}function Wk(e,t,n){let r=e.rootAttributes;return Kk(r?.display,r?.style)?n.participatesSymbolDefinition?.(e,t)??!0:!1}function A1(e,t={}){return{x:e.x,y:e.y,width:t.width!==void 0?t.width:e.width,height:t.height!==void 0?t.height:e.height,viewBoxX:e.viewBoxX,viewBoxY:e.viewBoxY,viewBoxWidth:e.viewBoxWidth,viewBoxHeight:e.viewBoxHeight,preserveAspectRatio:e.preserveAspectRatio}}function wo(e,t,n={}){let r=Jn(e);if(!r||r.kind!=="embedded-svg")return{matrix:Ke,attribute:null,pivotRequired:!1,pivotResolved:!1,viewport:ss({})};let i=ss(A1(r,n),t),o=An(e.state),s=i.frame?{x:i.frame.x+i.frame.width/2,y:i.frame.y+i.frame.height/2}:void 0;return{matrix:ur(e.state,s),attribute:fn(e.state,s),pivotRequired:o,pivotResolved:!o||s!==void 0,viewport:i}}function Xk(e,t,n){return t.diagnostics.map(r=>({code:r.code==="unresolved-viewport-size"?"unresolved-svg-viewport":"invalid-svg-viewport",shapeId:e.id,message:r.message,path:[...n,e.id]}))}function mu(e,t,n,r){let i=null,o=[],s=n.forceInlineChildren>0?hh(e):n.view.children(e);for(let a of s){if(!bc(a,n.host))continue;let c=vc(a,t,n,r);i=Sc(i,c.bounds),o.push(...c.diagnostics)}return vr(i,o)}function Yk(e,t){return{...e,diagnostics:e.diagnostics.map(n=>n.path.includes(t)?n:{...n,path:[t,...n.path]})}}function N1(e,t,n,r,i={}){let o=wo(e,r,i),s=Xk(e,o.viewport,n.path);if(o.pivotRequired&&!o.pivotResolved)return s.push({code:"unresolved-svg-viewport",shapeId:e.id,message:`Embedded SVG ${e.id} has decomposed rotation/scale/skew channels, but its auto viewport frame cannot be resolved without a parent viewport.`,path:[...n.path,e.id]}),vr(null,s,"unresolved");if(!o.viewport.renders)return vr(null,s,o.viewport.status==="zero-disabled"?"empty":"unresolved");let a=Hk(e,n);n.active.add(a),n.path.push(e.id);let l=e.state.isRootSvg===!0?t:Ie(Ie(t,Es(e,o.matrix,n.host)),o.viewport.contentMatrix??Ke),d=mu(e,l,n,o.viewport.childPercentBasis??r);return n.path.pop(),n.active.delete(a),vr(d.bounds,[...s,...d.diagnostics],d.status)}function E1(e,t,n={},r={}){let i=typeof t=="string"?e.shape(t):t;if(!i){let d=typeof t=="string"?t:t.id;return xr("unresolved",{code:"unresolved-shape",shapeId:d,message:`Shape ${d} is not present in the document bounds view.`,path:[d]})}let o=Jn(i);if(!o||o.kind!=="embedded-svg")return xr("unsupported",{code:"unsupported-shape",shapeId:i.id,message:`Shape ${i.id} is not an embedded SVG viewport.`,path:[i.id]});let s=wo(i,n.parentViewport),a=Xk(i,s.viewport,[]);if(!s.viewport.frame||s.pivotRequired&&!s.pivotResolved)return vr(null,a,"unresolved");let c=Ie(n.toTarget??Ke,Es(i,s.matrix,r)),l=s.viewport.frame;return{bounds:yh({minX:l.x,minY:l.y,maxX:l.x+l.width,maxY:l.y+l.height},c),status:"resolved",diagnostics:a}}function qk(e,t,n){let r=n.view.duplicateShapeIds?.().has(t)??!1;return xr("unresolved",{code:r?"duplicate-shape-id":"unresolved-reference-target",shapeId:e.id,message:r?`Shape reference ${e.id} targets ambiguous duplicate id ${t}.`:t?`Shape reference ${e.id} targets ${t}, which is not present in the document.`:`Shape reference ${e.id} has no targetShapeId.`,path:t?[...n.path,t]:[...n.path]})}function O1(e,t){let n=[...t.path,e.id];return xr("cycle",{code:"reference-cycle",shapeId:e.id,message:`Shape reference cycle detected: ${n.join(" -> ")}.`,path:n})}function Zk(e,t,n,r,i){if(!An(e.state))return{matrix:ur(e.state),attribute:fn(e.state),pivotRequired:!1,pivotResolved:!0,diagnostics:[],contentBounds:null};let s=ft(t.offsetX,t.offsetY),a={width:t.width,height:t.height},c=Yk(vc(n,s,r,i,a),e.id),l=c.diagnostics.some(u=>u.code==="unsupported-shape"||u.code==="deferred-tree-kind"||u.code==="unresolved-reference-pivot"),d=c.bounds&&!l?{x:(c.bounds.minX+c.bounds.maxX)/2,y:(c.bounds.minY+c.bounds.maxY)/2}:null;if(!d){let u=c.bounds===null&&(c.status==="empty"||c.status==="cycle"||c.status==="unresolved"),f={code:"unresolved-reference-pivot",shapeId:e.id,message:`Shape reference ${e.id} has decomposed rotation/scale/skew channels, but its translated target bounds require unavailable contextual geometry or measurement.`,path:[...r.path]};return{matrix:ur(e.state),attribute:fn(e.state),pivotRequired:!0,pivotResolved:u,diagnostics:u?c.diagnostics:[...c.diagnostics,f],contentBounds:c}}return{matrix:ur(e.state,d),attribute:fn(e.state,d),pivotRequired:!0,pivotResolved:!0,diagnostics:[],contentBounds:c}}function D1(e,t,n,r,i){if(r.activeReferences.has(e.id))return O1(e,r);r.activeReferences.add(e.id),r.path.push(e.id);let o=u=>(r.path.pop(),r.activeReferences.delete(e.id),u),s=t.targetShapeId?.trim()??"",a=s?r.view.shape(s):void 0;if(!a)return o(qk(e,s,r));if(!bc(a,r.host))return o(pu());let c=Zk(e,t,a,r,i);if(c.pivotRequired&&!c.pivotResolved)return o(vr(null,[...c.diagnostics],"unresolved"));if(c.contentBounds?.bounds===null&&c.pivotResolved)return o(c.contentBounds);let l=Ie(Ie(n,Es(e,c.matrix,r.host)),ft(t.offsetX,t.offsetY)),d=Yk(vc(a,l,r,i,{width:t.width,height:t.height}),e.id);return o({...d,diagnostics:[...c.diagnostics,...d.diagnostics]})}function Ns(e,t){let n=e.state.instancePresentation?.transform,r=typeof n=="string"&&n.trim()?n.trim():null,i=ur(e.state,t),o=fn(e.state,t);return r?{matrix:Ie(Rn(r),i),attribute:o?`${r} ${o}`:r}:{matrix:i,attribute:o}}function Io(e,t,n,r){return{code:n,shapeId:e.id,message:r,path:[...t.path,e.id]}}function Qk(e,t,n,r,i,o){let s=null,a=[];for(let c of n){if(!bc(c,i.host))continue;let l=vc(c,r,i,o);s=Sc(s,l.bounds),a.push(...l.diagnostics)}for(let c of t.definitionContentOrder??[]){if(c.kind!=="definition")continue;let l=i.view.libraryDefinition?.(c.id);if(!l||l.kind!=="symbol"){a.push(Io(e,i,"unresolved-symbol-definition",`Nested definition ${c.id} is missing from ${t.id}.`));continue}if((l.defKind??"symbol")==="symbol"||!Wk(l,e,i.host))continue;let d=`definition-forest\0${l.id}`;if(i.activeSymbols.has(d)){a.push(Io(e,i,"symbol-cycle",`Nested definition forest cycle detected through ${l.id}.`));continue}i.activeSymbols.add(d),i.path.push(l.id);let u=l.rootAttributes?.transform,f=u?Ie(r,Rn(u)):r,p=Qk(e,l,l.shapes,f,i,o);i.path.pop(),i.activeSymbols.delete(d),s=Sc(s,p.bounds),a.push(...p.diagnostics)}return vr(s,a)}function Jk(e,t,n,r,i,o=!1){let s=Zo(t,e),a=yc(e,t,i,{resolveLength:r.host.resolveSymbolLength}),c=[...s.diagnostics.map(g=>Io(e,r,g.code,g.message)),...a.diagnostics.map(g=>Io(e,r,g.code==="invalid-symbol-length"||g.code==="invalid-symbol-viewbox"?"invalid-symbol-viewport":"unresolved-symbol-viewport",g.message))];if(!a.renders){let g=a.viewport?.status==="zero-disabled";return{...vr(null,c,g?"empty":"unresolved"),transform:{...Ns(e),pivotRequired:An(e.state),pivotResolved:!0,diagnostics:c}}}if(!Wk(t,e,r.host))return{...pu(),transform:{...Ns(e),pivotRequired:An(e.state),pivotResolved:!0,diagnostics:c}};if(r.activeSymbols.has(s.materializationKey)){let g=Io(e,r,"symbol-cycle",`Symbol instance cycle detected through ${t.id}.`);return{...xr("cycle",g),transform:{...Ns(e),pivotRequired:An(e.state),pivotResolved:!0,diagnostics:[g]}}}r.activeSymbols.add(s.materializationKey),r.identityPrefixes.push(s.materializationKey),r.forceInlineChildren++,r.path.push(e.id);let l=g=>Qk(e,t,s.shapes,g,r,a.childPercentBasis??i),d=An(e.state),u=Ns(e),f=!d,p=[];if(d){let g=l(a.contentMatrix),h=g.diagnostics.some(S=>S.code==="unsupported-shape"||S.code==="deferred-tree-kind"||S.code==="unresolved-symbol-viewport"),y=g.bounds&&!h?{x:(g.bounds.minX+g.bounds.maxX)/2,y:(g.bounds.minY+g.bounds.maxY)/2}:void 0;if(y)u=Ns(e,y),f=!0;else{let S=g.bounds===null&&(g.status==="empty"||g.status==="cycle"||g.status==="unresolved");f=S,S||(p=[Io(e,r,"unresolved-symbol-pivot",`Symbol instance ${e.id} needs unavailable contextual geometry or measurement for its decomposed transform pivot.`)]),S&&!o&&(p=[...g.diagnostics])}}let m;if(d&&!f)m=vr(null,[...c,...p],"unresolved");else{let g=Ie(Ie(n,Es(e,u.matrix,r.host)),a.contentMatrix),h=l(g);m=vr(h.bounds,[...c,...p,...h.diagnostics],h.status)}return r.path.pop(),r.forceInlineChildren--,r.identityPrefixes.pop(),r.activeSymbols.delete(s.materializationKey),{...m,transform:{...u,pivotRequired:d,pivotResolved:f,diagnostics:[...c,...p]}}}function $1(e,t,n,r){let i=String(e.state.symbolId??"").trim(),o=i?n.view.duplicateLibraryIds?.().has(i)??!1:!1,s=i?n.view.libraryDefinition?.(i):void 0;if(o||!s||s.kind!=="symbol")return xr("unresolved",Io(e,n,o?"duplicate-library-id":"unresolved-symbol-definition",o?`Symbol instance ${e.id} targets duplicate library id ${i}.`:`Symbol instance ${e.id} targets missing symbol definition ${i||"(blank)"}.`));let a=Jk(e,s,t,n,r),{transform:c,...l}=a;return l}function vc(e,t,n,r,i={}){let o=Hk(e,n);if(n.active.has(o)){if(!n.collectDiagnostics)return{bounds:null,status:"cycle",diagnostics:[]};let l=[...n.path,e.id];return xr("cycle",{code:"container-cycle",shapeId:e.id,message:`Container cycle detected: ${l.join(" -> ")}.`,path:l})}let s=Jn(e);if(!s)return gh(e,s,t,n.host);if(s.kind==="shape-reference")return D1(e,s,t,n,r);if(s.kind==="embedded-svg")return N1(e,t,n,r,i);if(s.kind==="symbol-instance")return $1(e,t,n,r);if(s.kind!=="container"){let l=ur(e.state,s.defaultPivot??void 0);return gh(e,s,Ie(t,Es(e,l,n.host)),n.host)}n.active.add(o),n.path.push(e.id);let a=gc(e.state).matrix;if(An(e.state)){let l=n.collectDiagnostics;n.collectDiagnostics=!1;let d=mu(e,Ke,n,r);n.collectDiagnostics=l;let u=d.diagnostics.some(f=>f.code==="unsupported-shape"||f.code==="deferred-tree-kind");a=fu(e.state,u?null:d.bounds).matrix}let c=mu(e,Ie(t,Es(e,a,n.host)),n,r);return n.path.pop(),n.active.delete(o),c}function fi(e,t,n={},r={}){let i=typeof t=="string"?e.shape(t):t;if(!i){let o=typeof t=="string"?t:t.id;return xr("unresolved",{code:"unresolved-shape",shapeId:o,message:`Shape ${o} is not present in the document bounds view.`,path:[o]})}return vc(i,n.toTarget??Ke,{view:e,host:r,active:new Set,activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[],collectDiagnostics:!0},n.parentViewport)}function xc(e,t,n={},r={}){let i=typeof t=="string"?e.shape(t):t;if(!i){let s=typeof t=="string"?t:t.id;return xr("unresolved",{code:"unresolved-shape",shapeId:s,message:`Shape ${s} is not present in the document bounds view.`,path:[s]})}let o={...r,resolveOwnTransform:(s,a)=>s===i?Ke:r.resolveOwnTransform?.(s,a)??a};return fi(e,i,{parentViewport:n.parentViewport},o)}function Sh(e,t,n={},r){let i=Jn(t);if(!i||i.kind!=="shape-reference")return{matrix:Ke,attribute:null,pivotRequired:!1,pivotResolved:!1,diagnostics:[]};let o={view:e,host:n,active:new Set,activeReferences:new Set([t.id]),activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[t.id],collectDiagnostics:!0},s=i.targetShapeId?.trim()??"",a=s?e.shape(s):void 0;if(!a||!bc(a,n)){let l=An(t.state);return{matrix:ur(t.state),attribute:fn(t.state),pivotRequired:l,pivotResolved:!0,diagnostics:a?[]:qk(t,s,o).diagnostics}}let c=Zk(t,i,a,o,r);return{matrix:c.matrix,attribute:c.attribute,pivotRequired:c.pivotRequired,pivotResolved:c.pivotResolved,diagnostics:c.diagnostics}}function bh(e,t,n={},r){let i=An(t.state),o=String(t.state.symbolId??"").trim(),s=o?e.duplicateLibraryIds?.().has(o)??!1:!1,a=o?e.libraryDefinition?.(o):void 0;return s||!a||a.kind!=="symbol"?{...Ns(t),pivotRequired:i,pivotResolved:!0,diagnostics:[]}:Jk(t,a,Ke,{view:e,host:n,active:new Set,activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[],collectDiagnostics:!0},r,!0).transform}function M1(e,t={},n={}){let r=null,i=[];for(let o of e.roots()){if(!bc(o,n))continue;let s=fi(e,o,t,n);r=Sc(r,s.bounds),i.push(...s.diagnostics)}return vr(r,i)}function vh(e,t={}){if(!An(e.state))return{transform:gc(e.state),contentBounds:null,pivotRequired:!1,pivotResolved:!0};let i={view:Ur({shapes:[e],viewboxes:[]}),host:t,active:new Set([`document\0${e.id}`]),activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[e.id],collectDiagnostics:!0},o=mu(e,Ke,i),a=o.diagnostics.some(c=>c.code==="unsupported-shape"||c.code==="deferred-tree-kind")?null:o.bounds;return{transform:fu(e.state,a),contentBounds:o,pivotRequired:!0,pivotResolved:a!==null||o.status==="empty"}}function Ic(e,t=e.id){return{kind:"pattern",id:t,name:e.name??t,pattern:{type:"pattern",svgContent:e.svgContent,width:e.width,height:e.height,patternType:"custom",color:"#000000",backgroundColor:"transparent",scale:1,rotation:0,opacity:1,patternUnits:"userSpaceOnUse"}}}function xh(e){if(e.builtIn)return!1;let t=e.pattern;return!t||typeof t!="object"?!1:t.patternType==="custom"&&typeof t.svgContent=="string"}var z1=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:px)?$/u;function e0(e,t){if(e.patternUnits!=="userSpaceOnUse")return;let n=e.authoredGeometry?.[t]?.trim();if(n===void 0||!z1.test(n))return;let r=Number.parseFloat(n);return Number.isFinite(r)&&r>0?r:void 0}function Ih(e){let t=(e.viewBox??"").trim().split(/[\s,]+/).filter(o=>o.length>0).map(Number),n=t.length===4&&t.every(o=>Number.isFinite(o)),r=n&&t[2]>0?t[2]:e.width??e0(e,"width")??10,i=n&&t[3]>0?t[3]:e.height??e0(e,"height")??10;return{width:r,height:i}}function wh(e){if(!xh(e))return null;let{width:t,height:n}=Ih(e.pattern);return{id:e.id,name:e.name,svgContent:e.pattern.svgContent??"",width:t,height:n}}function F1(e,t){let n=new Map(t.map(o=>[o.id,o])),r=typeof e=="string"?n.get(e):e,i=new Set;for(;r?.kind==="pattern";){if(i.has(r.id))return null;if(i.add(r.id),xh(r))return r;let o=r.pattern?.templateId;if(!o)return null;r=n.get(o)}return null}function L1(e,t){let n=F1(e,t);if(!n)return null;let{width:r,height:i}=Ih($w(n,t)??n.pattern);return{id:n.id,name:n.name,svgContent:n.pattern.svgContent??"",width:r,height:i}}function _1(){let e=new Set(jb);for(let t of Ub)e.add(t);for(let t of Te.typeIds())for(let n of Object.keys(Te.getDefaults(t)))e.add(n);return e.delete("scaleAnchor"),e.delete("extra"),e}var t0=_1(),B1=new Set(["scaleAnchor","displayAttr"]);function gu(e){let t=e.extra&&typeof e.extra=="object"&&!Array.isArray(e.extra)?e.extra:void 0;for(let n of Object.keys(e)){if(n==="extra"||t0.has(n))continue;let r=e[n];delete e[n],r!==void 0&&((t??={})[n]=r)}return t&&Object.keys(t).length>0?e.extra=t:delete e.extra,e}function kh(e){return In(e,{onState:t=>{gu(t)}}),e}function Ph(e){return In(e,{onState:t=>{ko(t)}}),e}function ko(e){let t=e.extra;if(!t||typeof t!="object"||Array.isArray(t))return delete e.extra,e;for(let[n,r]of Object.entries(t))n!=="extra"&&(n in e||(e[n]=r));return delete e.extra,e}function Th(e){return typeof e=="string"&&e.length>0?e:null}function V1(e){let t=Th(e.groupId);if(t)return t;let n=e.extra;return!n||typeof n!="object"||Array.isArray(n)?null:Th(n.groupId)}function n0(e){delete e.groupId;let t=e.extra;if(!t||typeof t!="object"||Array.isArray(t))return;let n=t;delete n.groupId,Object.keys(n).length===0&&delete e.extra}function G1(e){let t={};return e.transformOrigin&&(t.transformOrigin=e.transformOrigin),e.pluginId&&(t.pluginId=e.pluginId),e.pluginData&&(t.pluginData=e.pluginData),e.attributes&&Object.keys(e.attributes).length>0&&(t.attributes=e.attributes),e.fill&&(t.fill=e.fill),e.fillOpacity&&(t.fillOpacity=e.fillOpacity),e.strokeOpacity&&(t.strokeOpacity=e.strokeOpacity),e.opacity&&(t.opacity=e.opacity),e.filter&&(t.filter=e.filter),e.cssFilter&&(t.cssFilter=e.cssFilter),e.mixBlendMode&&(t.mixBlendMode=e.mixBlendMode),e.isolation&&(t.isolation=e.isolation),e.clipPath&&(t.clipPath=e.clipPath),e.mask&&(t.mask=e.mask),e.rawMetadata&&(t.rawMetadata=e.rawMetadata),e.transform&&(t.transform=e.transform),t}function j1(e){let t=G1(e),n={fillColor:null,borderColor:null,rotation:0,skewX:0,skewY:0,customPivot:null};return Object.keys(t).length>0&&(n.groupData=t),{id:e.id,type:"group",state:n}}function r0(e,t){let n=e.state.children;if(Array.isArray(n))for(let r of n)t.add(r.id),r0(r,t)}function i0(e,t=!1){let n=e.state,r=n.children;return t&&n0(n),Array.isArray(r)&&(n.children=r.map(i=>i0(i,!0))),e}function U1(e){if(e.length<2)return e.map(s=>s.shape);let t=e.filter(s=>s.shape.type==="group"&&s.siblingIndex!==void 0&&Number.isFinite(s.siblingIndex)).sort((s,a)=>(s.siblingIndex??0)-(a.siblingIndex??0));if(t.length===0)return[...e].sort((s,a)=>s.flatOrder-a.flatOrder).map(s=>s.shape);let n=Array(e.length).fill(null),r=new Set(t);for(let s of t){let a=Math.max(0,Math.min(e.length-1,s.siblingIndex??0));for(;a<n.length&&n[a]!==null;)a++;if(a>=n.length)for(a=n.length-1;a>=0&&n[a]!==null;)a--;a>=0&&(n[a]=s)}let i=e.filter(s=>!r.has(s)).sort((s,a)=>s.flatOrder-a.flatOrder),o=0;for(let s of i){for(;o<n.length&&n[o]!==null;)o++;o<n.length&&(n[o]=s)}return n.filter(s=>s!==null).map(s=>s.shape)}function wc(e,t=[]){let n=structuredClone(e),r=structuredClone(t),i=new Map;for(let h of r)i.set(h.id,h);let o=n.map(h=>i0(h)),s=new Set;for(let h of o)r0(h,s);let a=new Map,c=new Map;o.forEach((h,y)=>{s.has(h.id)||c.has(h.id)||(a.set(h.id,y),c.set(h.id,h))});for(let h of r){if(s.has(h.id)||c.has(h.id))continue;let y=j1(h);a.set(y.id,Number.POSITIVE_INFINITY),c.set(y.id,y)}let l=new Map,d=new Map;for(let h of c.values()){let y=h.state,S=i.get(h.id),b=V1(y)??(h.type==="group"?Th(S?.parentId):null),I=l.get(b)??[];d.set(h.id,b),I.push({shape:h,flatOrder:a.get(h.id)??Number.POSITIVE_INFINITY,siblingIndex:h.type==="group"?S?.siblingIndex:void 0}),l.set(b,I)}let u=new Set,f=h=>{if(u.has(h.id))return null;u.add(h.id);let y=h.state,S=Array.isArray(y.children)?y.children:[],b=p(h.id),I=new Set(S.map(w=>w.id)),v=[...S,...b.filter(w=>!I.has(w.id))];return v.length>0?y.children=v:delete y.children,n0(y),h},p=h=>{let y=[];for(let S of U1(l.get(h)??[])){let b=f(S);b&&y.push(b)}return y},m=p(null),g=h=>{if(!h)return;let y=f(h);y&&m.push(y)};for(let h of c.values()){let y=d.get(h.id);y&&!c.has(y)&&g(h)}for(let h of r)g(c.get(h.id));for(let h of c.values())g(h);return m}var hu="data-svgsketch-passthrough",H1=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]),K1=/^<([A-Za-z][\w:-]*)\b[^>]*>/;function o0(e){return K1.exec(e.trimStart())}function yu(e){let t=o0(e);if(!t)return null;let n=/\bid\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(t[0]);return n?n[1]??n[2]:null}function W1(e){let t=o0(e);if(!t)return null;let n=t[1],r=n.lastIndexOf(":");return r>=0?n.slice(r+1):n}var X1=new RegExp(`\\s+${hu}\\s*=\\s*(?:"[^"]*"|'[^']*')`);function Su(e){let t=e.markup.indexOf(">");if(t<0)return e;let n=e.markup.slice(0,t+1),r=X1.exec(n);if(!r)return e;let i=n.slice(0,r.index)+n.slice(r.index+r[0].length);return{...e,markup:i+e.markup.slice(t+1),passthrough:!0}}function s0(e){let t=[];for(let n of e){if(typeof n!="string")continue;let r=yu(n);if(!r)continue;let i=W1(n),o=i&&H1.has(i)?i:"mask";t.push(Su({id:r,type:o,markup:n}))}return t}var Y1=[["splinePoints","pathPoints"],["splineClosed","pathClosed"],["splineCurveType","pathCurveType"],["splineTension","pathTension"],["splineArcParams","pathArcParams"],["splineControlBounds","pathControlBounds"]];function q1(e){let t=!1;if(e.type==="spline"&&(e.type="path",t=!0),e.state&&typeof e.state=="object"){let n=e.state,r=n.extra&&typeof n.extra=="object"&&!Array.isArray(n.extra)?n.extra:null;for(let[i,o]of Y1)Object.prototype.hasOwnProperty.call(n,i)&&(Object.prototype.hasOwnProperty.call(n,o)||(n[o]=n[i]),Reflect.deleteProperty(n,i),t=!0),r&&Object.prototype.hasOwnProperty.call(r,i)&&(Object.prototype.hasOwnProperty.call(n,o)||(n[o]=r[i]),delete r[i],t=!0);r&&Object.keys(r).length===0&&delete n.extra}return t}function a0(e){return ht(e,{onShape:t=>{q1(t)}}),e}function Z1(e){if(e.type!=="connector")return;let t=e.state,n=kc(t.sourcePoint),r=kc(t.targetPoint);e.type="line",e.state={...e.state,x1:typeof t.x1=="number"?t.x1:n?.x??0,y1:typeof t.y1=="number"?t.y1:n?.y??0,x2:typeof t.x2=="number"?t.x2:r?.x??0,y2:typeof t.y2=="number"?t.y2:r?.y??0,routingMode:t.routingMode??"orthogonal"}}function u0(e){let t=e.customPivot;if(t)return t;let n=e.x,r=e.y,i=e.width,o=e.height;if(typeof n=="number"&&typeof r=="number"&&typeof i=="number"&&typeof o=="number")return{x:n+i/2,y:r+o/2};let s=e.radius;if(typeof n=="number"&&typeof r=="number"&&typeof s=="number")return{x:n,y:r};let a=e.cx,c=e.cy;if(typeof a=="number"&&typeof c=="number")return{x:a,y:c};let l=e.x1,d=e.y1,u=e.x2,f=e.y2;if(typeof l=="number"&&typeof d=="number"&&typeof u=="number"&&typeof f=="number")return{x:(l+u)/2,y:(d+f)/2};let p=e.pathPoints;if(p?.[0])return{x:p[0].x,y:p[0].y};let m=e.polylinePoints;if(m?.[0])return{x:m[0].x,y:m[0].y}}function Q1(e){return ht(e,{onShape:t=>{let n=t.state;!n||typeof n!="object"||_v(n,u0(n))}}),e.schemaVersion=3,e}function kc(e){let t=e;return t&&typeof t.x=="number"&&Number.isFinite(t.x)&&typeof t.y=="number"&&Number.isFinite(t.y)?{x:t.x,y:t.y}:null}function J1(e,t){let n=e.translateX??0,r=e.translateY??0,i=typeof e.rawTransform=="string"?e.rawTransform:"",o=ft(n,r);if(i)return Ct(Ie(o,Rn(i)));let s=e.rotation??0,a=e.skewX??0,c=e.skewY??0;if(s!==0||a!==0||c!==0){let u=kc(e.customPivot)??t??kc(e.scaleAnchor);u&&(o=Ie(o,ft(u.x,u.y)),s!==0&&(o=Ie(o,Pa(s))),a!==0&&(o=Ie(o,Nl(a))),c!==0&&(o=Ie(o,El(c))),o=Ie(o,ft(-u.x,-u.y)))}let l=e.scaleX??1,d=e.scaleY??1;if(l!==1||d!==1){let u=kc(e.scaleAnchor)??t;u&&(o=Ie(o,ft(u.x,u.y)),o=Ie(o,Wo(l,d)),o=Ie(o,ft(-u.x,-u.y)))}return Ct(o)}function eB(e){return ht(e,{onShape:t=>{let n=t.state;!n||typeof n!="object"||!("scaleAnchor"in n)||(t.type==="text"&&!xi(n.transformMatrix)&&(n.transformMatrix=J1(n,u0(n))),delete n.scaleAnchor)}}),e.schemaVersion=4,e}function tB(e){let t=e,n=Array.isArray(e.library)?[...e.library]:[],r=new Set(n.map(l=>l.id));if(Array.isArray(t.symbols))for(let l of t.symbols)!l||r.has(l.id)||(n.push({...l,kind:"symbol"}),r.add(l.id));if(Array.isArray(t.markers))for(let l of t.markers)!l||r.has(l.id)||(n.push({...l,kind:"marker"}),r.add(l.id));let i=new Map,o=(l,d)=>{let{id:u,sourceId:f,...p}=l,m=JSON.stringify({kind:d,...p}),g=i.get(m);if(g)return g;let h=r.has(l.id)?`grd-${bu()}`:l.id;r.add(h),i.set(m,h);let y=d==="linear-gradient"?{kind:"linear-gradient",id:h,name:l.sourceId??h,sourceId:l.sourceId,gradient:c0(l)}:{kind:"radial-gradient",id:h,name:l.sourceId??h,sourceId:l.sourceId,gradient:c0(l)};return n.push(y),h},s=new Map;if(Array.isArray(t.customPatterns))for(let l of t.customPatterns){if(!l)continue;let d=r.has(l.id)?`pat-${bu()}`:l.id;r.add(d),s.set(l.id,d),n.push(Ic(l,d))}let a=l=>{if(l.customPatternId){let S=s.get(l.customPatternId);if(S)return S}let{id:d,sourceId:u,customPatternId:f,...p}=l,m=JSON.stringify({kind:"pattern",...p}),g=i.get(m);if(g)return g;let h=r.has(l.id)?`pat-${bu()}`:l.id;r.add(h),i.set(m,h);let y={kind:"pattern",id:h,name:l.sourceId??h,sourceId:l.sourceId,pattern:p};return n.push(y),h};for(let l of e.shapes??[]){let d=l.state;if(!d)continue;let u=d.fillGradient;u&&(typeof d.fillType!="string"&&(d.fillType=u.type),u.type==="linear-gradient"||u.type==="radial-gradient"?d.fillLibraryId=o(u,u.type):u.type==="pattern"&&(d.fillLibraryId=a(u)));let f=d.strokeGradient;f&&(typeof d.strokeType!="string"&&(d.strokeType=f.type),f.type==="linear-gradient"||f.type==="radial-gradient"?d.strokeLibraryId=o(f,f.type):f.type==="pattern"&&(d.strokeLibraryId=a(f)));let p=d.filters;if(Array.isArray(p)&&p.length>0){let m=c(p,d,l.id);d.filterLibraryIds=[m]}}return e.library=n,ht(e,{onShape:Z1}),delete t.customPatterns,delete t.symbols,delete t.markers,e;function c(l,d,u){let f={filters:l,colorInterpolation:d.filterColorInterpolation,filterUnits:d.filterUnits,primitiveUnits:d.primitiveUnits,x:d.filterX,y:d.filterY,width:d.filterWidth,height:d.filterHeight},p=JSON.stringify({kind:"filter",...f}),m=i.get(p);if(m)return m;let g=`filter-${u}`,h=r.has(g)?`flt-${bu()}`:g;r.add(h),i.set(p,h);let y={kind:"filter",id:h,name:h,filters:f.filters,...f.colorInterpolation?{colorInterpolation:f.colorInterpolation}:{},...f.filterUnits?{filterUnits:f.filterUnits}:{},...f.primitiveUnits?{primitiveUnits:f.primitiveUnits}:{},...f.x!==void 0?{x:f.x}:{},...f.y!==void 0?{y:f.y}:{},...f.width!==void 0?{width:f.width}:{},...f.height!==void 0?{height:f.height}:{}};return n.push(y),h}}function c0(e){let{id:t,sourceId:n,...r}=e;return r}var Rh=0;function bu(){return Rh=Rh+1&65535,`${Date.now().toString(36)}-${Rh.toString(36)}`}function nB(e){return ht(e,{onState:t=>{let n=t,r=Object.prototype.hasOwnProperty.call(n,"richTextData"),i=n.richTextData;if(gu(t),!r)return;n.richTextData=i;let o=t.extra;o&&(delete o.richTextData,Object.keys(o).length===0&&delete t.extra)}}),e.schemaVersion=5,e}function rB(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;if(t.richTextRuns!==void 0&&t.richTextRuns!==null)return;let n=t.richTextData;!n||typeof n!="object"||Array.isArray(n)||Array.isArray(n.lines)&&(t.richTextRuns=Ei(n))}function iB(e){return ht(e,{onState:t=>rB(t)}),e.schemaVersion=6,e}function Ch(e,t){if(!t.has(e))return e;let n=2;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function Pc(e){let t=new Set,n=new Set,r=new Map;ht(e,{onShape:o=>{if(n.add(o.id),o.type!=="view")return;r.has(o.id)||r.set(o.id,o);let s=o.state.viewName;typeof s=="string"&&s&&t.add(s)}});let i=[];return(e.viewboxes??[]).filter(o=>{let s=r.get(o.id);return!(s&&s.state.viewBoxX===o.x&&s.state.viewBoxY===o.y&&s.state.viewBoxWidth===Math.max(1,o.width)&&s.state.viewBoxHeight===Math.max(1,o.height))}).forEach((o,s)=>{let a=Ch(`view-${s+1}`,t);t.add(a);let c=Ch(o.id||`legacy-view-${s+1}`,n);n.add(c),i.push({id:c,type:"view",state:{viewBoxX:o.x,viewBoxY:o.y,viewBoxWidth:Math.max(1,o.width),viewBoxHeight:Math.max(1,o.height),viewName:a}})}),i.length>0&&e.shapes.unshift(...i),e.viewboxes=[],e}var oB=["svgX","svgY","svgWidth","svgHeight","svgViewBoxX","svgViewBoxY","svgViewBoxWidth","svgViewBoxHeight","svgPreserveAspectRatio"];function sB(e){if(e.type!=="svg"||e.state.isRootSvg===!0)return;let t=e.state;if(![t.svgViewBoxX,t.svgViewBoxY,t.svgViewBoxWidth,t.svgViewBoxHeight].every(i=>i===0))return;if(t.svgX===0&&t.svgY===0&&t.svgWidth===0&&t.svgHeight===0&&t.svgPreserveAspectRatio===""){for(let i of oB)delete t[i];return}delete t.svgViewBoxX,delete t.svgViewBoxY,delete t.svgViewBoxWidth,delete t.svgViewBoxHeight}function f0(e){return ht(e,{onShape:sB}),Pc(e),e.schemaVersion=7,e}var aB=["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"];function cB(e,t){if(e.type!=="symbol-instance"||e.state.authoredUseGeometry!==void 0)return;let n={};for(let r of["x","y","width","height"]){if((r==="width"||r==="height")&&t.has(String(e.state.symbolId??"")))continue;let i=e.state[r];typeof i=="number"&&Number.isFinite(i)&&(n[r]=String(i))}Object.keys(n).length>0&&(e.state.authoredUseGeometry=n)}function lB(e){let t=new Set((e.library??[]).filter(n=>n.kind==="symbol"&&n.defKind==="group").map(n=>n.id));for(let n of e.library??[]){if(n.kind!=="symbol")continue;let r=n,i={...r.wrapperAttrs??{},...r.rootAttributes??{}};for(let s of aB){let a=i[s];r[s]===void 0&&a!==void 0&&(r[s]=a),delete i[s]}if(r.overflow!==void 0&&i.overflow===void 0&&(i.overflow=r.overflow),Object.keys(i).length>0?r.rootAttributes=i:delete r.rootAttributes,r.shapes=wc(r.shapes,r.groups),r.variants)for(let[s,a]of Object.entries(r.variants))r.variants[s]=wc(a,r.groups);let o=r;delete o.wrapperAttrs,delete o.groups,delete o.overflow}return ht(e,{onShape:n=>cB(n,t)}),e.schemaVersion=8,e}function dB(e){let t=e;Array.isArray(e.shapes)&&(e.shapes=wc(e.shapes,t.groups)),delete t.groups,Array.isArray(t.rawPaintServerDefs)&&!Array.isArray(e.paintServerDefs)&&(e.paintServerDefs=s0(t.rawPaintServerDefs)),delete t.rawPaintServerDefs;for(let n of e.library??[]){if(n.kind!=="marker")continue;let r=n;r.shapes=wc(r.shapes,r.groups),delete r.groups}return Array.isArray(t.clipMaskGroups)&&(e.clipMaskGroups=t.clipMaskGroups.map(n=>{let r=n,i=Array.isArray(r.clipShapeIds)?r.clipShapeIds:typeof r.clipShapeId=="string"&&r.clipShapeId.length>0?[r.clipShapeId]:[],o={...r,clipShapeIds:i};return delete o.clipShapeId,o})),e.schemaVersion=9,e}function uB(e){return ht(e,{onState:t=>{let n=t;n.richTextRuns===void 0&&n.richTextData!==null&&typeof n.richTextData=="object"&&Array.isArray(n.richTextData.lines)&&(n.richTextRuns=Ei(n.richTextData)),delete n.richTextData}}),e.schemaVersion=10,e}function fB(e){let n=(Array.isArray(e)?e.slice(0,6).join(" "):String(e)).trim().toLowerCase();return n==="none"||n==="hidden"||n==="collapse"?"none":"inline"}function l0(e){let t=new Set(e.keyframes.flatMap(n=>n.id?[n.id]:[]));if(e.keyframes.forEach((n,r)=>{if(n.id)return;let i=`kf${r}`;for(;t.has(i);)i=`${i}x`;n.id=i,t.add(i)}),e.property==="visibility"&&e.sourceSmilAttribute==="display"){e.property="display";for(let n of e.keyframes)n.value=fB(n.value)}delete e.sourceSmilAttribute}function pB(e){if(!Array.isArray(e.shapes))return;let t=new Map,n=new Map,r=new Map,i=(s,a)=>{let c=a?n:t,l=c.get(s.id)??[];l.push(s),c.set(s.id,l),r.set(s.id,(r.get(s.id)??0)+1);let d=s.state.children;Array.isArray(d)&&d.forEach(u=>i(u,!0))};e.shapes.forEach(s=>i(s,!1));let o=new Set;for(let[s,a]of t)a.length!==1||r.get(s)!==2||(n.get(s)??[]).length===1&&o.add(s);e.shapes=e.shapes.filter(s=>!o.has(s.id))}function mB(e){if(!Array.isArray(e.shapes))return;ht(e,{onShape:a=>{if(a.type!=="view")return;let c=a.state;Reflect.deleteProperty(c,"viewLinkedSvgId"),typeof c.extra=="object"&&c.extra!==null&&!Array.isArray(c.extra)&&Reflect.deleteProperty(c.extra,"viewLinkedSvgId")}});let t=e.shapes.filter(a=>{if(a.type!=="view")return!1;let c=a.state;return c.isHomeView===!0||typeof c.extra=="object"&&c.extra!==null&&!Array.isArray(c.extra)&&c.extra.isHomeView===!0});if(t.length===0)return;let n=t[0].state,r=Number(n.viewBoxWidth??0),i=Number(n.viewBoxHeight??0),o=e.shapes.find(a=>a.type==="svg"&&a.state.isRootSvg===!0);if(o&&r>0&&i>0){let a=Number(o.state.svgViewBoxWidth??0),c=Number(o.state.svgViewBoxHeight??0);a>0&&c>0||(o.state.svgViewBoxX=Number(n.viewBoxX??0),o.state.svgViewBoxY=Number(n.viewBoxY??0),o.state.svgViewBoxWidth=r,o.state.svgViewBoxHeight=i,Number(o.state.svgWidth??0)>0||(o.state.svgWidth=r),Number(o.state.svgHeight??0)>0||(o.state.svgHeight=i))}let s=new Set(t.map(a=>a.id));e.shapes=e.shapes.filter(a=>!s.has(a.id)),e.sceneTree=e.sceneTree?.filter(a=>!s.has(a.id))}function gB(e){if(!Array.isArray(e.shapes))return;let t=new Set;ht(e,{onShape:i=>{typeof i.id=="string"&&t.add(i.id)}});let n=new Map,r=i=>i.map(o=>{let s=o.state.children;Array.isArray(s)&&(o.state.children=r(s));let a=o.state.metadata;if(!a||typeof a!="object"||Array.isArray(a))return o;let c=typeof a.linkUrl=="string"?a.linkUrl:"",l=typeof a.linkTarget=="string"?a.linkTarget:"";if(!Object.hasOwn(a,"linkUrl")&&!Object.hasOwn(a,"linkTarget"))return o;let{linkUrl:d,linkTarget:u,...f}=a;if(o.state.metadata=f,!c||o.type==="hyperlink")return o;let p=Ch(`${o.id}-link`,t);return t.add(p),n.set(o.id,p),{id:p,type:"hyperlink",state:{href:c,...l?{linkTarget:l}:{},children:[o]}}});e.shapes=r(e.shapes);for(let i of e.library??[])if(!(i.kind!=="symbol"&&i.kind!=="marker")&&(i.shapes=r(i.shapes),i.kind==="symbol"&&i.variants))for(let[o,s]of Object.entries(i.variants))i.variants[o]=r(s);if(e.sceneTree&&n.size>0){let i=[];for(let o of e.sceneTree){let s=n.get(o.id);if(!s){i.push(o);continue}i.push({...o,id:s}),i.push({id:o.id,parentId:s,index:0})}e.sceneTree=i}}function hB(e){ht(e,{onState:t=>{(t.fillType==="linear-gradient"||t.fillType==="radial-gradient"||t.fillType==="pattern")&&t.fillColor==="none"&&t.fillOpacity===0&&(t.fillOpacity=1)}})}function yB(e){ht(e,{onState:t=>{Array.isArray(t.charOffsets)&&(t.charOffsets=t.charOffsets.map(n=>{if(!n||typeof n!="object"||"dx"in n||typeof n.x!="number")return n;let r=n;return{x:null,y:null,dx:r.x,dy:typeof r.y=="number"&&Number.isFinite(r.y)?r.y:0,rotate:typeof r.rotate=="number"&&Number.isFinite(r.rotate)?r.rotate:0}}))}})}function SB(e){ht(e,{onShape:t=>{if(t.type!=="group")return;let n=t.state,r=n.groupData;if(!r||typeof r!="object"||Array.isArray(r))return;let i=r,o=i.attributes;if(o&&typeof o=="object"&&!Array.isArray(o)){let s={...o};n.locked===void 0&&s["data-locked"]==="true"&&(n.locked=!0),n.visible===void 0&&s["data-hidden"]==="true"&&(n.visible=!1),delete s["data-locked"],delete s["data-hidden"],Object.keys(s).length>0?i.attributes=s:delete i.attributes}Array.isArray(i.classes)&&(i.classes=i.classes.map(s=>{let a=String(s);return a.startsWith("usr-")?a.slice(4):a}))}})}function bB(e){let t=a0(e);Pc(t),mB(t),pB(t),gB(t),hB(t),yB(t),SB(t);for(let n of t.animationTimeline?.tracks??[])l0(n);for(let n of t.library??[])if(!(n.kind!=="marker"&&n.kind!=="symbol"))for(let r of n.animations??[])l0(r);return t.schemaVersion=11,t}function p0(e){return e.schemaVersion=12,e}function vB(e){return e.schemaVersion=13,e}function xB(e){return e.schemaVersion=14,e}function m0(e){return ht(e,{onState:t=>{let n=t,r=n.authoredTextStructure;if(n.textSpanTree===void 0&&r&&typeof r.text=="string"&&Array.isArray(r.spans)){let i=r.spans.flatMap(o=>{if(!o||typeof o!="object"||Array.isArray(o))return[];let s=o;return typeof s.start=="number"&&typeof s.end=="number"&&typeof s.id=="string"?[{start:s.start,end:s.end,id:s.id,children:[]}]:[]});i.length===r.spans.length&&(n.textSpanTree={text:r.text,spans:i})}delete n.authoredTextStructure}}),e.schemaVersion=15,e}function g0(e){return e.schemaVersion=16,e}function h0(e){for(let t of e.documentStyles??[]){let n=t;n.placement??="root"}return e.schemaVersion=17,e}function y0(e){return e.schemaVersion=18,e}function S0(e){return ht(e,{onState:t=>{let n=t;n.textPathReference===void 0&&typeof n.textPathRefShapeId=="string"&&n.textPathRefShapeId.length>0&&(n.textPathReference={kind:"shape",targetId:n.textPathRefShapeId,element:"href"}),delete n.textPathRefShapeId,delete n.textPathImportRefId}}),e.schemaVersion=19,e}function IB(e){return e.schemaVersion=20,e}function wB(e){return e.schemaVersion=21,e}function kB(e){let t=new Map,n=(r,i,o)=>{let s=r.textSpanTree;if(!s||typeof s!="object"||Array.isArray(s))return;let a=s.spans;if(!Array.isArray(a))return;let c=new Map,l=(d,u=[])=>{d.forEach((f,p)=>{if(!f||typeof f!="object"||Array.isArray(f))return;let m=f,g=[...u,p],h=typeof m.spanId=="string"&&m.spanId.length>0?m.spanId:`text-span:${i}:${g.join(".")}`;m.spanId=h,c.set(g.join("."),h),Array.isArray(m.children)&&l(m.children,g)})};l(a),o&&t.set(o,c)};return ht(e,{onShape:(r,i)=>n(r.state,r.id||i,r.id),onState:(r,i)=>n(r,i)}),e.animationTimeline&&(e.animationTimeline.tracks=e.animationTimeline.tracks.filter(r=>{let i=r.textSpanTarget;if(!i||Array.isArray(i.spanIds))return!0;let o=Array.isArray(i.path)?i.path:[],s=o.every(c=>Number.isInteger(c)&&Number(c)>=0)?o.join("."):"",a=s?t.get(r.shapeId)?.get(s):void 0;return a?(i.spanIds=[a],delete i.path,!0):!1})),e.schemaVersion=22,e}function PB(e){let t=br(e),n=r=>{let i=r.authoredPlacement;if(!i||i.parentDefinitionId!==void 0)return;let o=t.resolve(i);o.kind==="library"&&(i.parentDefinitionId=o.definitionId)};for(let r of e.library??[])n(r);for(let r of e.paintServerDefs??[])n(r);for(let r of e.clipMaskGroups??[])n(r);return e.schemaVersion=23,e}function TB(e){return e.schemaVersion=24,e}function RB(e){return e.schemaVersion=25,e}function CB(e){return ht(e,{onShape(t){if(t.type!=="foreign-object")return;let n=t.state,r=n.rawContent;if(typeof r!="string")return;let i=Cn(`<svg xmlns="${te}"><foreignObject>${r}</foreignObject></svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"}).value,o=i?.index.children(i.root.sourceNodeId).find(s=>s.localName.toLowerCase()==="foreignobject");n.foreignContent=o?structuredClone(lc(o.children)):r.length===0?[]:[{kind:"text",value:r}],delete n.rawContent}}),e.schemaVersion=26,e}function AB(e){let t=typeof e.shapeId=="string"?e.shapeId:"";if(t.startsWith("__dom__")&&t.length>7)return t.slice(7);let n=typeof e.domTargetSelector=="string"?e.domTargetSelector:"",r=/\[id\s*=\s*(["'])(.*?)\1\]/u.exec(n);return r?.[2]?r[2]:/^#([A-Za-z_][\w:.-]*)$/u.exec(n.trim())?.[1]??null}function d0(e,t){return e?Cn(`<svg xmlns="${te}">${e}</svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"}).value?.nodes.some(r=>r.kind==="element"&&r.attributes.some(i=>i.namespaceUri===null&&i.localName==="id"&&i.value===t))??!1:!1}function NB(e,t){for(let n of e.clipMaskGroups??[]){let r=n.definitionId??`${n.type}-${n.id}`;if(r===t)return{definitionId:r};if(d0(n.rawDefinition,t))return{definitionId:r,nodeId:t}}for(let n of e.paintServerDefs??[]){if(n.id===t)return{definitionId:n.id};if(d0(n.markup,t))return{definitionId:n.id,nodeId:t}}for(let n of e.library??[]){if(n.id===t||n.sourceId===t)return{definitionId:n.id};if(n.kind==="filter")for(let r of n.filters){if(r.type!=="svg-primitive-chain")continue;let i=r.primitives.find(o=>o.id===t);if(i)return{definitionId:n.id,nodeId:i.id}}}return{definitionId:t}}function EB(e){let t=typeof e.property=="string"?e.property:"";if(t==="domTransformStack")return"targetTransformStack";if(t==="domDisplay")return"targetDisplay";if(t==="domVisibility")return"targetVisibility";if(t!=="domAttribute")return t;let n=typeof e.domAttribute=="string"?e.domAttribute:"",r=n.toLowerCase();return new Map([["class","className"],["fill","fillColor"],["stroke","strokeColor"],["preserveaspectratio","svgPreserveAspectRatio"],["xlink:href","referenceTargetShapeId"],["href","referenceTargetShapeId"],["clippathunits","clipPathUnits"],["spreadmethod","spreadMethod"]]).get(r)??n}function OB(e){let t=e.animationTimeline;for(let n of t?.tracks??[]){let r=n,i=AB(r);if(!i)continue;let o=NB(e,i);r.definitionTarget=o,r.shapeId=Or(o),r.property=EB(r),typeof r.domAttribute=="string"&&(r.targetAttribute=r.domAttribute),typeof r.domAttributeValueType=="string"&&(r.targetAttributeValueType=r.domAttributeValueType),delete r.domTargetSelector,delete r.domTargetIdGenerated,delete r.domAttribute,delete r.domAttributeValueType}return e.schemaVersion=27,e}function DB(e){return e.schemaVersion=28,e}function $B(e){let t=e.clipMaskGroups;if(!Array.isArray(t)||t.length===0)return e.schemaVersion=29,e;let n=new Set;for(let o of e.shapes)In(o,{onShape:s=>n.add(s.id)});let r=new Set;for(let o of t){let s=typeof o.rawDefinition=="string"&&o.rawDefinition.length>0,a=o.clipShapeIds.some(c=>n.has(c));(s||a)&&r.add(`${o.type}\0${Ut(o)}`)}let i=t.filter(o=>r.has(`${o.type}\0${Ut(o)}`));return i.length!==t.length&&(e.clipMaskGroups=rr(i),jr(e)),e.schemaVersion=29,e}var b0=Object.freeze({1:tB,2:Q1,3:eB,4:nB,5:iB,6:f0,7:lB,8:dB,9:uB,10:bB,11:p0,12:vB,13:xB,14:m0,15:g0,16:h0,17:y0,18:S0,19:IB,20:wB,21:kB,22:PB,23:TB,24:RB,25:CB,26:OB,27:DB,28:$B});function MB(e){let t=e.schemaVersion;return typeof t!="number"||!Number.isFinite(t)||t<1?1:Math.floor(t)}function Tc(e,t=b0){let n=JSON.parse(JSON.stringify(e)),r=MB(n);if(r>Tn)return n;if(r===Tn)return n.schemaVersion=Tn,n;for(;r<Tn;){let i=t[r];if(!i)throw new Error(`[svgsketch/core] No migration registered for schema version ${r} \u2192 ${r+1}. Cannot safely upgrade this document to version ${Tn}.`);n=i(n),r+=1}return n.schemaVersion=Tn,n}var zB=["unknown-shape-diagnostic","symbol-variants-overrides","smil-timeline","motion-only-partition","paint-server-references","filter-references","document-definition-context","inline-child-containers","isolated-flowchart-nodes","text-path","common-presentation","gradient-definition-envelope","filter-definition-envelope","export-precision-rounding","defs-deduplication","source-id-restoration","orphan-def-exclusion","font-embedding","initial-value-elision","namespace-declaration-completion"],ge=e=>({mode:"supported",by:e}),Gi=e=>({mode:"diagnostic",signal:"warning",by:e}),Oe=e=>({mode:"outside-contract",reason:e}),Ft=e=>e,v0=Oe("DXF is a static CAD geometry contract and has no representation for this SVG behavior."),x0=Oe("Mermaid is a static graph-structure contract and has no representation for this SVG behavior."),I0=Oe("PDF export produces a static page from the current editor SVG projection and does not promise animation playback."),FB={"unknown-shape-diagnostic":Ft({renderToSvg:Gi("renderShape reports UNSUPPORTED_SHAPE_TYPE through renderToSvgWithDiagnostics"),codegen:Gi("buildRenderPlan carries UNSUPPORTED_SHAPE_TYPE into generateCodeWithDiagnostics"),dxf:Gi("DxfExportStats records unsupported types and the DXF export UI reports them"),mermaid:Gi("exportMermaidWithDiagnostics records unsupported nodes and both Mermaid UIs report them"),pdf:Oe("PDF conversion consumes an already-projected editor SVG; unknown model nodes never enter its input."),"editor-dom":Oe("Unknown nodes are preserved for round-trip but require a registered shape implementation for projection.")}),"symbol-variants-overrides":Ft({renderToSvg:ge("buildRenderPlan materializes symbol variants and per-instance overrides before emission"),codegen:ge("every component backend consumes buildRenderPlan symbol materialization"),dxf:Gi("DXF unsupported-shape accounting reports symbol instances without a lowering"),mermaid:Gi("Mermaid node-skip diagnostics report symbol instances without a lowering"),pdf:ge("the editor projects SymbolInstance content into the SVG consumed by svg2pdf"),"editor-dom":ge("SymbolInstance projects resolved library variants and overrides")}),"smil-timeline":Ft({renderToSvg:ge("buildRenderPlan injects renderAnimationElements output into target and document-root markup"),codegen:ge("component backends preserve SMIL elements in planned target and document-root markup"),dxf:v0,mermaid:x0,pdf:I0,"editor-dom":ge("AnimationManager and the shared SMIL kernel project live playback")}),"motion-only-partition":Ft({renderToSvg:ge("buildRenderPlan diverts motionOnly templates into defs outside visible paint"),codegen:ge("component backends consume the render plan visible and motion-def partitions"),dxf:v0,mermaid:x0,pdf:I0,"editor-dom":Oe("The authoring DOM retains motion templates for editing instead of applying export partitioning.")}),"paint-server-references":Ft({renderToSvg:ge("plan defs and shapes use one library-first paint-server reference resolver"),codegen:ge("buildShapeAttrs and plan defs use the library-first reference resolver"),dxf:Oe("DXF promises geometry and basic entity colors, not SVG paint-server definition graphs."),mermaid:Oe("Mermaid graph syntax has no SVG gradient or pattern paint-server model."),pdf:ge("the cloned SVG carries paint-server definitions and references into svg2pdf"),"editor-dom":ge("GradientManager maintains live defs matching shape paint references")}),"filter-references":Ft({renderToSvg:ge("renderFilterDefs and filterReferenceValue emit matching identifiers"),codegen:ge("planned filter defs and buildShapeAttrs share filter reference resolution"),dxf:Oe("DXF entity geometry has no SVG filter graph or filter-reference representation."),mermaid:Oe("Mermaid graph syntax has no SVG filter graph or filter-reference representation."),pdf:ge("the cloned SVG carries filter definitions and references into svg2pdf"),"editor-dom":ge("FilterManager maintains live filter definitions and shape references")}),"document-definition-context":Ft({renderToSvg:ge("buildRenderPlan consumes the full snapshot definition and style context"),codegen:ge("component codegen accepts snapshot context and clipboard supplies its definitions"),dxf:Oe("DXF consumes resolved shapes and does not serialize SVG document definition sections."),mermaid:Oe("Mermaid consumes graph nodes and does not serialize SVG definition sections."),pdf:ge("PDF receives a cloned SVG document with its referenced definition context"),"editor-dom":ge("the document aggregate and managers project referenced resources into defs")}),"inline-child-containers":Ft({renderToSvg:ge("renderShape recursively renders INLINE_CHILD_CONTAINER_TYPES children"),codegen:ge("component backends preserve recursively rendered plan container markup"),dxf:ge("DXF walks INLINE_CHILD_CONTAINER_TYPES with transforms and cycle guards"),mermaid:Gi("unsupported container nodes are counted by exportMermaidWithDiagnostics"),pdf:ge("the cloned editor SVG preserves nested containers for svg2pdf"),"editor-dom":ge("registered containers project managed children into nested SVG elements")}),"isolated-flowchart-nodes":Ft({renderToSvg:Oe("Isolated-node declarations are a Mermaid graph concern, not an SVG branch."),codegen:Oe("Isolated-node declarations are a Mermaid graph concern, not component SVG output."),dxf:Oe("DXF emits geometry independently and has no connector-enrollment requirement."),mermaid:ge("exportMermaid declares mapped nodes before emitting connector edges"),pdf:Oe("PDF paints SVG geometry independently and has no graph-node declaration requirement."),"editor-dom":Oe("The live SVG projects shapes independently and has no graph-node declaration requirement.")}),"text-path":Ft({renderToSvg:ge("renderText emits textPath markup and its referenced or private path definition; the render plan routes textPathMorph SMIL into that private path or into textPath for the inline path form"),codegen:ge("component backends preserve planned textPath markup, path definitions and their textPathMorph SMIL children"),dxf:Oe("DXF text entities do not reproduce SVG textPath layout along arbitrary paths."),mermaid:Oe("Mermaid labels do not reproduce SVG textPath layout along arbitrary paths."),pdf:Gi("ExportPanel.generatePdfBlob detects textPath content and shows its localized warning"),"editor-dom":ge("Text projects textPath attributes and maintains its referenced path")}),"common-presentation":Ft({renderToSvg:ge("commonAttrs projects the ordered PRESENTATION_SEMANTICS vocabulary"),codegen:ge("buildShapeAttrs projects the ordered PRESENTATION_SEMANTICS vocabulary"),dxf:Oe("DXF is not an SVG presentation-attribute serialization contract."),mermaid:Oe("Mermaid is not an SVG presentation-attribute serialization contract."),pdf:ge("svg2pdf consumes common presentation attributes from the cloned SVG"),"editor-dom":ge("COMMON_PROP_RENDERERS derives its dispatch from PRESENTATION_SEMANTICS")}),"gradient-definition-envelope":Ft({renderToSvg:ge("gradient renderers serialize the shared typed definition envelopes"),codegen:ge("render plan defs contain gradients serialized from shared typed envelopes"),dxf:Oe("DXF has no SVG linearGradient or radialGradient definition envelope."),mermaid:Oe("Mermaid has no SVG linearGradient or radialGradient definition envelope."),pdf:ge("the cloned SVG supplies shared-envelope gradient definitions to svg2pdf"),"editor-dom":ge("GradientManager projects shared gradient envelopes into live defs")}),"filter-definition-envelope":Ft({renderToSvg:ge("renderFilterElement serializes filterDefinitionEnvelope for each wrapper kind"),codegen:ge("render plan defs contain filters serialized from shared typed envelopes"),dxf:Oe("DXF has no SVG filter element or primitive graph envelope representation."),mermaid:Oe("Mermaid has no SVG filter element or primitive graph envelope representation."),pdf:ge("the cloned SVG supplies shared-envelope filter definitions to svg2pdf"),"editor-dom":ge("FilterManager projects filterDefinitionEnvelope before primitive emission")}),"export-precision-rounding":Ft({renderToSvg:ge("finalizeRenderPlan rounds markup coordinates at the effective documentMetadata.coordinatePrecision"),codegen:Oe("Codegen backends consume the un-finalized render plan; component output precision is a code-style concern, not an export boundary."),dxf:Oe("DXF numeric precision is owned by the DXF writer, not the SVG export boundary."),mermaid:Oe("Mermaid emits graph syntax rather than SVG coordinate attribute streams."),pdf:ge("PDF viewbox pages consume the plan-assembled string (core rounding); selection pages pass through SvgExportFinalizer.roundSvgAttributes"),"editor-dom":ge("static string exports round through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks round through SvgExportFinalizer.roundSvgAttributes; the raster clone sink skips rounding by design (spelling-only, pixel-irrelevant)")}),"defs-deduplication":Ft({renderToSvg:ge("finalizeRenderPlan collapses content-identical gradient/pattern/marker defs and rewrites references"),codegen:Oe("Codegen backends consume the un-finalized render plan; def duplication in generated components is a code-size concern outside the export contract."),dxf:Oe("DXF output has no shared-definition graph in which duplicates could exist."),mermaid:Oe("Mermaid output has no shared-definition graph in which duplicates could exist."),pdf:ge("PDF viewbox pages consume the plan-assembled string (core dedup); selection pages pass through SvgExportFinalizer.deduplicateDefsForExport"),"editor-dom":ge("static string exports dedup through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks run SvgExportFinalizer.deduplicateDefsForExport; the raster clone sink skips dedup by design (spelling-only, pixel-irrelevant)")}),"source-id-restoration":Ft({renderToSvg:ge("finalizeRenderPlan restores uncontested library sourceIds and rewrites references"),codegen:Oe("Generated components keep collision-safe runtime ids; source ids are a document round-trip concern."),dxf:Oe("DXF entities carry no SVG id namespace for source ids to be restored into."),mermaid:Oe("Mermaid nodes carry no SVG id namespace for source ids to be restored into."),pdf:Oe("PDF output has no id namespace to restore; the intermediate SVG string restores ids for fidelity but the PDF consumer never observes them."),"editor-dom":ge("static string exports restore source ids through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks run SvgExportFinalizer.restoreSourceIds; the raster clone sink skips restoration by design (ids are spelling, not pixels)")}),"orphan-def-exclusion":Ft({renderToSvg:ge("def emission is demand-driven (collectReferencedLibraryDefs, the referenced-marker gate, the paint-server reachability fixed point) \u2014 unreferenced defs are never emitted, so no pruning pass exists or is needed"),codegen:ge("component backends consume the same demand-driven plan def channels"),dxf:Oe("DXF output has no defs graph from which orphans could need excluding."),mermaid:Oe("Mermaid output has no defs graph from which orphans could need excluding."),pdf:ge("the editor SVG consumed by svg2pdf passes through pruneOrphanedDefs"),"editor-dom":ge("static string exports are demand-driven via the core plan (no orphans emitted); the raster/selection clone sinks sweep accumulated live defs with SvgExportFinalizer.pruneOrphanedDefs")}),"font-embedding":Ft({renderToSvg:ge("finalizeRenderPlan ships @font-face CSS from the injected resolveFontEmbedCss hook (core is platform-free; binary resolution is the caller environment responsibility)"),codegen:Oe("Generated components inherit the host page font pipeline; embedding binaries in component source is out of contract."),dxf:Oe("DXF text styling is font-name based; the format has no font binary embedding."),mermaid:Oe("Mermaid delegates font resolution entirely to the rendering host page."),pdf:ge("svg2pdf consumes the editor SVG after the async export inlined @font-face CSS"),"editor-dom":ge("every sink that leaves the live document embeds: static and animated string exports resolve plan-collected FACES (family + weight + style) through fontManager into the core resolveFontEmbedCss hook, and the embedded-SVG subtree and selection exports run SvgExportFinalizer.embedFontsInOutput over the projected tree. Raster sinks embed too, subset to the characters they render - an SVG handed to an <img> is processed in secure static/animated mode (SVG 2 2.2.4/2.2.6), so it resolves no external references and inherits none of the session live font faces. Only the internal clipboard payload skips embedding, because the session that wrote it is the session that reads it")}),"initial-value-elision":Ft({renderToSvg:ge("finalizeRenderPlan drops redundant spec initials and product defaults under an initial-valued cascade (elideInitialValuesInPlan)"),codegen:Oe("Codegen backends consume the un-finalized plan; explicit values in component source are a readability choice, not an export-boundary concern."),dxf:Oe("DXF entities carry explicit CAD attributes with no SVG initial-value cascade."),mermaid:Oe("Mermaid emits graph syntax; SVG presentation initial values never appear in its output."),pdf:ge("PDF viewbox pages consume the plan-assembled string (core elision); selection pages pass through SvgExportFinalizer.stripDefaultPaintAttributes"),"editor-dom":ge("static string exports elide through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks run SvgExportFinalizer.stripDefaultPaintAttributes and the output-artifact rules; the raster clone sink keeps default attributes by design (elision is spelling-only)")}),"namespace-declaration-completion":Ft({renderToSvg:ge("finalizeRenderPlan declares used prefixes on the root via a well-known URI table (declareUsedNamespacePrefixes); unresolvable prefixes warn undeclarable-namespace-prefix"),codegen:Oe("Generated components render into a host document whose framework owns namespace handling; JSX/Vue templates have no xmlns declaration surface to complete."),dxf:Oe("DXF is not XML and has no namespace prefixes to declare or complete."),mermaid:Oe("Mermaid graph syntax is not XML; no namespace declarations exist."),pdf:ge("svg2pdf consumes the editor SVG string whose serializer declared every namespace it uses"),"editor-dom":ge("static string exports complete declarations through core declareUsedNamespacePrefixes; the raster/selection clone sinks rely on XMLSerializer plus hoistForeignNamespaceDecls")})};function Po(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}async function Nh(e,t,n,r){let i=e[t];typeof i=="string"&&(e[t]=await r(i,n))}async function Ah(e,t){Po(e)&&await Nh(e,"svgContent","svgMarkup",t)}async function Eh(e,t){if(!Po(e))return;await Nh(e,"href","href",t),await Ah(e.fillGradient,t),await Ah(e.strokeGradient,t);let n=e.children;if(Array.isArray(n))for(let r of n)Po(r)&&await Eh(r.state,t)}async function LB(e,t){if(!Po(e))return;let n=e.shapes;if(Array.isArray(n))for(let o of n)Po(o)&&await Eh(o.state,t);let r=e.library;if(Array.isArray(r))for(let o of r)Po(o)&&o.kind==="pattern"&&await Ah(o.pattern,t);let i=e.customPatterns;if(Array.isArray(i))for(let o of i)Po(o)&&await Nh(o,"svgContent","svgMarkup",t)}function Rc(e,t,n={}){let r=vo(e),i=r.errors.filter(o=>!n.ignoreError?.(o));if(i.length>0){let o=i.map(s=>` ${s.path}: ${s.message}`).join(`
|
|
42
42
|
`);throw new Error(`Invalid .svgs document:
|
|
43
43
|
${o}`)}return n.includeWarnings===!1?[]:r.warnings.map(o=>({severity:"warning",code:/\.type$/.test(o.path)&&/Unknown shape type/.test(o.message)?"unavailable-shape-descriptor":"native-validation-warning",source:"native-document",entrypoint:t,message:o.message,documentPath:o.path}))}function Oh(e,t={}){let{indent:n=2,trailingNewline:r=!0,validate:i=!1}=t;if(i){let a=vo(e);if(!a.valid){let c=a.errors.map(l=>` ${l.path}: ${l.message}`).join(`
|
|
44
44
|
`);throw new Error(`Invalid document:
|
|
@@ -95,4 +95,4 @@ ${t.join(`
|
|
|
95
95
|
${g.join(`
|
|
96
96
|
`)}
|
|
97
97
|
}`)}let l=[];for(let p of r.body){if(p.kind==="shape"){l.push(`${n}${KR(p.markup,o.get(p))}`);continue}l.push(`${n}${p.open}`);for(let m of p.members)l.push(`${n}${n}${KR(m.markup,o.get(m))}`);l.push(`${n}${p.close}`)}let d=Kn(r.defs),u=r.documentCss,f=[];f.push("<style>");for(let p of c)f.push(p);u.length>0&&f.push(u),f.push("</style>"),f.push(""),f.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${r.frame.width}" height="${r.frame.height}" viewBox="${r.frame.viewBox}">`),d.length>0&&f.push(`${n}<defs>${d}</defs>`);for(let p of l)f.push(p);return f.push("</svg>"),f.push(""),f.join(`
|
|
98
|
-
`)}function jS(e,t){return WR(e,t).code}function WR(e,t){let n=new $s;return{code:Iu(n,()=>f2(e,t)),diagnostics:n.diagnostics}}function f2(e,t){let n=m2(e,t),r={...t};return Fy(p2(n,r))}function p2(e,t){switch(t.format){case"svg":return LS(e,t);case"react":return _S(e,t);case"vue":return BS(e,t);case"d3":return VS(e,t);case"css":return GS(e,t);default:throw new Error(`Unsupported code format: ${t.format}`)}}function m2(e,t){if(Array.isArray(e)){let n=$P(e);return{shapes:e,viewboxes:[{id:"default",x:0,y:0,width:t.width??800,height:t.height??600}],...n.length>0?{library:n}:{}}}return e}var US=class e{_snapshot;constructor(t={}){let{width:n=800,height:r=600,viewboxId:i}=t,o=ks(0,0,n,r,i);this._snapshot=pc({viewboxes:[o]})}static fromSnapshot(t){let n=new e;return n._snapshot=JSON.parse(JSON.stringify(t)),n}static fromJSON(t,n){let r=Dh(t,n),i=new e;return i._snapshot=r,i}static fromSVG(t,n){return e.fromSnapshot(Xy(t,n))}add(t){let n="build"in t&&typeof t.build=="function"?t.build():t;return this._snapshot.shapes.push(n),this}addAll(...t){for(let n of t)this.add(n);return this}remove(t){let n=this._snapshot.shapes.length;return this._snapshot.shapes=this._snapshot.shapes.filter(r=>r.id!==t),this._snapshot.shapes.length<n}get shapes(){return this._snapshot.shapes}findShape(t){return this._snapshot.shapes.find(n=>n.id===t)}size(t,n){return this._snapshot.viewboxes.length>0?(this._snapshot.viewboxes[0].width=t,this._snapshot.viewboxes[0].height=n):this._snapshot.viewboxes=[ks(0,0,t,n)],this}get width(){return this._snapshot.viewboxes[0]?.width??800}get height(){return this._snapshot.viewboxes[0]?.height??600}title(t){return this._ensureMetadata(),this._snapshot.documentMetadata.title=t,this}description(t){return this._ensureMetadata(),this._snapshot.documentMetadata.description=t,this}author(t){return this._ensureMetadata(),this._snapshot.documentMetadata.author=t,this}keywords(...t){return this._ensureMetadata(),this._snapshot.documentMetadata.keywords=t,this}license(t,n){return this._ensureMetadata(),this._snapshot.documentMetadata.license=t,n!==void 0&&(this._snapshot.documentMetadata.licenseUrl=n),this}language(t){return this._ensureMetadata(),this._snapshot.documentMetadata.language=t,this}customMetadata(t){return this._ensureMetadata(),this._snapshot.documentMetadata.customMetadata={...this._snapshot.documentMetadata.customMetadata,...t},this}get meta(){return this._snapshot.documentMetadata}defineSymbol(t,n,r){let i=me(),o=n.map(l=>"build"in l&&typeof l.build=="function"?l.build():l),s={kind:"symbol",id:i,name:t,shapes:o};r?.thumbnail&&(s.thumbnail=r.thumbnail),r?.defKind&&(s.defKind=r.defKind),r?.definitionPlacement&&(s.definitionPlacement=r.definitionPlacement);let a={...r?.rootAttributes??{}},c=a.viewBox;delete a.viewBox,r?.viewBox!==null&&(s.viewBox=r?.viewBox??c??"0 0 100 100");for(let l of["preserveAspectRatio","x","y","width","height","refX","refY"])r?.[l]!==void 0?s[l]=r[l]:s[l]===void 0&&a[l]!==void 0&&(s[l]=a[l]),delete a[l];return Object.keys(a).length>0&&(s.rootAttributes=a),r?.variantAxes&&(s.variantAxes=r.variantAxes),r?.variants&&(s.variants=Object.fromEntries(Object.entries(r.variants).map(([l,d])=>[l,d]))),r?.variantThumbnails&&(s.variantThumbnails=r.variantThumbnails),this._pushLibraryDef(s),i}placeSymbolInstance(t,n,r,i={}){let o=i.width,s=i.height,a={symbolId:t,x:n,y:r,width:o??100,height:s??100},c=i.authoredUseGeometry??{x:String(n),y:String(r),...o!==void 0?{width:String(o)}:{},...s!==void 0?{height:String(s)}:{}};Object.keys(c).length>0&&(a.authoredUseGeometry=c),i.variantKey&&(a.variantKey=i.variantKey),i.symbolOverrides&&(a.symbolOverrides=i.symbolOverrides),i.instancePresentation&&(a.instancePresentation=i.instancePresentation);let l={id:me(),type:"symbol-instance",state:a};return this._snapshot.shapes.push(l),this}removeSymbol(t){if(!this._snapshot.library)return!1;let n=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(r=>!(r.kind==="symbol"&&r.id===t)),this._snapshot.library.length<n}get symbols(){return(this._snapshot.library??[]).filter(t=>t.kind==="symbol")}defineMarker(t,n,r){let i=me(),o=n.map(a=>"build"in a&&typeof a.build=="function"?a.build():a),s={kind:"marker",id:i,name:t,viewBox:r?.viewBox??"0 0 10 10",refX:r?.refX??5,refY:r?.refY??5,markerWidth:r?.markerWidth??10,markerHeight:r?.markerHeight??10,markerUnits:r?.markerUnits??"strokeWidth",orient:r?.orient??"auto",shapes:o};return r?.preserveAspectRatio!==void 0&&(s.preserveAspectRatio=r.preserveAspectRatio),r?.authoredGeometry&&(s.authoredGeometry={...r.authoredGeometry}),r?.rootAttributes&&(s.rootAttributes={...r.rootAttributes}),r?.thumbnail&&(s.thumbnail=r.thumbnail),this._pushLibraryDef(s),i}defineFilter(t,n,r){let i=me(),o={kind:"filter",id:i,name:t,filters:n};return r?.colorInterpolation&&(o.colorInterpolation=r.colorInterpolation),r?.filterUnits&&(o.filterUnits=r.filterUnits),r?.primitiveUnits&&(o.primitiveUnits=r.primitiveUnits),r?.x!==void 0&&(o.x=r.x),r?.y!==void 0&&(o.y=r.y),r?.width!==void 0&&(o.width=r.width),r?.height!==void 0&&(o.height=r.height),r?.thumbnail&&(o.thumbnail=r.thumbnail),this._pushLibraryDef(o),i}defineLinearGradientLibrary(t,n,r){let i=me(),o="build"in n?n.build():n,{id:s,sourceId:a,...c}=o,l={kind:"linear-gradient",id:i,name:t,gradient:c};return r?.thumbnail&&(l.thumbnail=r.thumbnail),this._pushLibraryDef(l),i}defineRadialGradientLibrary(t,n,r){let i=me(),o="build"in n?n.build():n,{id:s,sourceId:a,...c}=o,l={kind:"radial-gradient",id:i,name:t,gradient:c};return r?.thumbnail&&(l.thumbnail=r.thumbnail),this._pushLibraryDef(l),i}definePatternLibrary(t,n,r){let i=me(),o="build"in n?n.build():n,{id:s,sourceId:a,customPatternId:c,...l}=o,d={kind:"pattern",id:i,name:t,pattern:l};return r?.thumbnail&&(d.thumbnail=r.thumbnail),this._pushLibraryDef(d),i}removeLibraryDef(t){if(!this._snapshot.library)return!1;let n=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(r=>r.id!==t),this._snapshot.library.length<n}get library(){return this._snapshot.library??[]}_pushLibraryDef(t){this._snapshot.library||(this._snapshot.library=[]);let n=this._snapshot.library.findIndex(r=>r.id===t.id);n>=0?this._snapshot.library[n]=t:this._snapshot.library.push(t)}addClipGroup(t,n,r){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=me(),o={id:i,type:"clip",clipShapeIds:t,contentShapeIds:n,parentId:null};return r?.clipPathUnits&&(o.clipPathUnits=r.clipPathUnits),r?.definitionPlacement&&(o.definitionPlacement=r.definitionPlacement),r?.clipRule&&(o.clipRule=r.clipRule),r?.rawDefinition&&(o.rawDefinition=r.rawDefinition),this._snapshot.clipMaskGroups.push(o),i}addMaskGroup(t,n,r){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=me(),o={id:i,type:"mask",clipShapeIds:t,contentShapeIds:n,parentId:null};return r?.maskUnits&&(o.maskUnits=r.maskUnits),r?.maskContentUnits&&(o.maskContentUnits=r.maskContentUnits),r?.maskBounds&&(o.maskBounds=r.maskBounds),r?.maskType&&(o.maskType=r.maskType),r?.definitionPlacement&&(o.definitionPlacement=r.definitionPlacement),r?.rawDefinition&&(o.rawDefinition=r.rawDefinition),this._snapshot.clipMaskGroups.push(o),i}removeClipMaskGroup(t){if(!this._snapshot.clipMaskGroups)return!1;let n=this._snapshot.clipMaskGroups.length;return this._snapshot.clipMaskGroups=this._snapshot.clipMaskGroups.filter(r=>r.id!==t),this._snapshot.clipMaskGroups.length<n}addGuide(t,n,r){this._snapshot.guides||(this._snapshot.guides=[]);let i=me(),o={id:i,orientation:t,position:n,controlPointOffset:0};return r?.color&&(o.color=r.color),r?.opacity!==void 0&&(o.opacity=r.opacity),this._snapshot.guides.push(o),i}removeGuide(t){if(!this._snapshot.guides)return!1;let n=this._snapshot.guides.length;return this._snapshot.guides=this._snapshot.guides.filter(r=>r.id!==t),this._snapshot.guides.length<n}clearGuides(){return this._snapshot.guides=[],this}get guides(){return this._snapshot.guides??[]}addMeasurement(t,n,r){this._snapshot.measurements||(this._snapshot.measurements=[]);let i=me(),o={id:i,type:t,points:n,visible:r?.visible??!0,snapDivisions:r?.snapDivisions??1};return r?.color&&(o.color=r.color),r?.opacity!==void 0&&(o.opacity=r.opacity),this._snapshot.measurements.push(o),i}removeMeasurement(t){if(!this._snapshot.measurements)return!1;let n=this._snapshot.measurements.length;return this._snapshot.measurements=this._snapshot.measurements.filter(r=>r.id!==t),this._snapshot.measurements.length<n}get measurements(){return this._snapshot.measurements??[]}addCustomPattern(t,n,r,i){let o=me();return this._pushLibraryDef(Ic({id:o,name:t,svgContent:n,width:r,height:i})),o}removeCustomPattern(t){let n=this._snapshot.library;if(!n)return!1;let r=n.length;return this._snapshot.library=n.filter(i=>!(i.kind==="pattern"&&i.id===t)),this._snapshot.library.length<r}get customPatterns(){let t=[];for(let n of this._snapshot.library??[]){if(n.kind!=="pattern")continue;let r=wh(n);r&&t.push(r)}return t}bringToFront(t){let n=this._snapshot.shapes.findIndex(r=>r.id===t);if(n>=0){let[r]=this._snapshot.shapes.splice(n,1);this._snapshot.shapes.push(r)}return this}sendToBack(t){let n=this._snapshot.shapes.findIndex(r=>r.id===t);if(n>=0){let[r]=this._snapshot.shapes.splice(n,1);this._snapshot.shapes.unshift(r)}return this}reorder(t,n){let r=this._snapshot.shapes.findIndex(i=>i.id===t);if(r>=0){let[i]=this._snapshot.shapes.splice(r,1),o=Math.max(0,Math.min(n,this._snapshot.shapes.length));this._snapshot.shapes.splice(o,0,i)}return this}defineVariable(t,n,r,i){this._snapshot.templateVariables||(this._snapshot.templateVariables=[]);let o=this._snapshot.templateVariables.find(s=>s.name===t);if(o)o.type=n,o.defaultValue=r,i?.label!==void 0&&(o.label=i.label),i?.description!==void 0&&(o.description=i.description);else{let s={name:t,type:n,defaultValue:r};i?.label!==void 0&&(s.label=i.label),i?.description!==void 0&&(s.description=i.description),this._snapshot.templateVariables.push(s)}return this}removeVariable(t){return this._snapshot.templateVariables&&(this._snapshot.templateVariables=this._snapshot.templateVariables.filter(n=>n.name!==t)),this}get variables(){return this._snapshot.templateVariables??[]}inspectVariables(){return Fh(this._snapshot)}setTimeline(t){return"build"in t&&typeof t.build=="function"?this._snapshot.animationTimeline=t.build():this._snapshot.animationTimeline=t,this}clearTimeline(){return delete this._snapshot.animationTimeline,this}get timeline(){return this._snapshot.animationTimeline}toSVG(t){let{variables:n,...r}=t??{},i=vu(this._snapshot,n);return nl(i,r)}toSVGWithDiagnostics(t){let{variables:n,...r}=t??{},i=vu(this._snapshot,n);return Pf(i,r)}toJSON(t){return Oh(this._snapshot,t)}toSnapshot(){return JSON.parse(JSON.stringify(this._snapshot))}toCode(t,n){return jS(this._snapshot,{...n,format:t})}_ensureMetadata(){this._snapshot.documentMetadata||(this._snapshot.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{}})}};var HS=class{_track;constructor(t,n){this._track={id:me(),shapeId:t,property:n,keyframes:[],enabled:!0,locked:!1}}id(t){return this._track.id=t,this}keyframe(t,n,r="linear"){return this._track.keyframes.push({id:me(),time:t,value:n,easing:r}),this}keyframeBezier(t,n,r){return this._track.keyframes.push({id:me(),time:t,value:n,easing:"custom-bezier",customBezier:r}),this}keyframeLinear(t,n,r){return this._track.keyframes.push({id:me(),time:t,value:n,easing:"linear-function",linearPoints:r}),this}keyframes(...t){return this._track.keyframes.push(...t.map(n=>({...n,id:n.id??me()}))),this}disabled(){return this._track.enabled=!1,this}locked(){return this._track.locked=!0,this}motionPath(t){return this._track.motionPath=t,this}motionPathRef(t,n="trackShape"){return this._track.motionPathRef={shapeId:t,mode:n},this}beginTrigger(t,n){return this._track.beginTrigger={type:t,value:n},this}endTrigger(t,n){return this._track.endTrigger={type:t,value:n},this}cycleDuration(t){return this._track.cycleDuration=t,this}cycleRepeats(t){return this._track.cycleRepeats=t,this}infinite(){return this._track.cycleInfinite=!0,this}cycle(t){return this._track.cycleBehavior=t,this}transformOrigin(t,n){return this._track.transformOrigin={x:t,y:n},this._track.targetTransformOrigin=void 0,this}motionRotate(t){return this._track.motionRotate=t,this}additive(t){return this._track.additive=t,this}accumulate(t="sum"){return this._track.accumulate=t,this}fill(t){return this._track.fill=t,this}fillBackwards(t=!0){return this._track.fillBackwards=t,this}build(){let t=[...this._track.keyframes].sort((n,r)=>n.time-r.time);return{...this._track,keyframes:t}}},KS=class{_duration;_loop=!1;_playbackSpeed=1;_tracks=[];constructor(t){this._duration=t}loop(t=!0){return this._loop=t,this}speed(t){return this._playbackSpeed=t,this}duration(t){return this._duration=t,this}addTrack(t){return this._tracks.push(t),this}addTracks(...t){return this._tracks.push(...t),this}buildTimeline(){return{duration:this._duration,loop:this._loop,playbackSpeed:this._playbackSpeed,tracks:this._tracks.map(t=>t.build())}}build(){let t=this.buildTimeline();return{duration:t.duration,loop:t.loop,playbackSpeed:t.playbackSpeed,tracks:t.tracks.map(n=>({id:n.id,shapeId:n.shapeId,property:n.property,enabled:n.enabled,locked:n.locked||void 0,motionPath:n.motionPath,motionPathRef:n.motionPathRef,beginTrigger:n.beginTrigger,endTrigger:n.endTrigger,cycleDuration:n.cycleDuration,simpleDuration:n.simpleDuration,cycleRepeats:n.cycleRepeats,cycleInfinite:n.cycleInfinite,cycleBehavior:n.cycleBehavior,fillBackwards:n.fillBackwards,transformOrigin:n.transformOrigin,targetTransformOrigin:n.targetTransformOrigin,motionRotate:n.motionRotate,additive:n.additive,accumulate:n.accumulate,fill:n.fill,keyframes:n.keyframes.map(r=>({id:r.id,time:r.time,value:r.value,easing:r.easing,...r.customBezier?{customBezier:r.customBezier}:{},...r.linearPoints?{linearPoints:r.linearPoints}:{}}))}))}}};var ln=class{_id;_type;_state={};constructor(t,n){this._type=t,this._id=n??me()}id(t){return this._id=t,this}locked(t=!0){return this._state.locked=t,this}visible(t=!0){return this._state.visible=t,this}displayMode(t){return this._state.displayMode=t,this}motionOnly(){return this._state.displayMode="motionOnly",this}fill(t,n){return this._state.fillColor=t,this._state.fillType="solid",n!==void 0&&(this._state.fillOpacity=n),this}noFill(){return this._state.fillType="none",this}fillGradient(t){let n="build"in t?t.build():t;return this._state.fillType=n.type,this._state.fillGradient=n,this}fillPattern(t){let n="build"in t?t.build():t;return this._state.fillType="pattern",this._state.fillGradient=n,this}fillOpacity(t){return this._state.fillOpacity=t,this}fillRule(t){return this._state.fillRule=t,this}addFill(t,n){let r={id:`fill-${this.nextLayerOrdinal("fill")}`,kind:"fill",color:t,paintType:"solid"};return n!==void 0&&(r.opacity=n),this.pushAppearanceLayer(r),this}addStroke(t,n){let r={id:`stroke-${this.nextLayerOrdinal("stroke")}`,kind:"stroke",color:t,paintType:"solid"};return n!==void 0&&(r.width=n),this.pushAppearanceLayer(r),this}pushAppearanceLayer(t){let n=Xf(this._state,t);Object.assign(this._state,n)}nextLayerOrdinal(t){let r=(this._state.appearance??[]).filter(i=>i.kind===t).length;return Math.max(r,1)}stroke(t,n){return this._state.borderColor=t,n!==void 0&&(this._state.borderWidth=n),this}noStroke(){return this._state.borderColor="none",this._state.borderWidth=0,this}strokeWidth(t){return this._state.borderWidth=t,this}strokeOpacity(t){return this._state.strokeOpacity=t,this}strokeGradient(t){let n="build"in t?t.build():t;return this._state.strokeType=n.type,this._state.strokeGradient=n,this}strokePattern(t){let n="build"in t?t.build():t;return this._state.strokeType="pattern",this._state.strokeGradient=n,this}strokeLinejoin(t){return this._state.strokeLinejoin=t,this}strokeLinecap(t){return this._state.strokeLinecap=t,this}strokeMiterlimit(t){return this._state.strokeMiterlimit=t,this}dashOffset(t){return this._state.dashOffset=t,this}strokeDasharray(t){return this._state.strokeDasharray=t,this}dash(t,n,r){return this._state.lineStyle=t,t==="custom"&&(n!==void 0&&(this._state.dashLength=n),r!==void 0&&(this._state.gapLength=r)),this}opacity(t){return this._state.opacity=t,this}rotate(t){return this._state.rotation=t,this.refreshTransformMatrix(),this}skew(t,n){return this._state.skewX=t,this._state.skewY=n,this.refreshTransformMatrix(),this}scale(t,n){return this._state.scaleX=t,this._state.scaleY=n??t,this.refreshTransformMatrix(),this}pivot(t,n){return this._state.customPivot={x:t,y:n},this.refreshTransformMatrix(),this}transformMatrix(t){if(t.length<6||!t.slice(0,6).every(Number.isFinite))throw new RangeError("transformMatrix must contain six finite numbers");return this._state.transformMatrix=t.slice(0,6),this}refreshTransformMatrix(){this._state.transformMatrix=Ct($l(this._state,this.defaultTransformPivot()))}defaultTransformPivot(){let t=this._state.customPivot;if(t)return t;let n=this._state.x,r=this._state.y,i=this._state.width,o=this._state.height;if(n!==void 0&&r!==void 0&&i!==void 0&&o!==void 0)return{x:n+i/2,y:r+o/2};let s=this._state.radius;if(n!==void 0&&r!==void 0&&s!==void 0)return{x:n,y:r};let a=this._state.cx,c=this._state.cy;if(a!==void 0&&c!==void 0)return{x:a,y:c};let l=this._state.x1,d=this._state.y1,u=this._state.x2,f=this._state.y2;if(l!==void 0&&d!==void 0&&u!==void 0&&f!==void 0)return{x:(l+u)/2,y:(d+f)/2};let p=this._state.pathPoints;if(p?.[0])return{x:p[0].x,y:p[0].y};let m=this._state.polylinePoints;if(m?.[0])return m[0]}filter(...t){let n=this._state.filters??[];return this._state.filters=[...n,...t],this}dropShadow(t={}){let n={id:`drop-shadow-${me()}`,type:"drop-shadow",enabled:!0,offsetX:t.offsetX??4,offsetY:t.offsetY??4,blurRadius:t.blurRadius??8,spread:t.spread??0,color:t.color??"#000000",opacity:t.opacity??.3};return this.filter(n)}innerShadow(t={}){let n={id:`inner-shadow-${me()}`,type:"inner-shadow",enabled:!0,offsetX:t.offsetX??2,offsetY:t.offsetY??2,blurRadius:t.blurRadius??4,choke:t.choke??0,color:t.color??"#000000",opacity:t.opacity??.5};return this.filter(n)}blur(t,n,r){let i=t??4,o=n??i,s={id:`gaussian-blur-${me()}`,type:"gaussian-blur",enabled:!0,blurX:i,blurY:o,linked:i===o,quality:r?.quality??"normal"};return this.filter(s)}glow(t={}){let n={id:`glow-${me()}`,type:"glow",enabled:!0,color:t.color??"#ffffff",radius:t.radius??10,intensity:t.intensity??.8};return this.filter(n)}innerGlow(t={}){let n={id:`inner-glow-${me()}`,type:"inner-glow",enabled:!0,color:t.color??"#ffffff",radius:t.radius??10,intensity:t.intensity??.8};return this.filter(n)}grayscale(t=1){let n={id:`grayscale-${me()}`,type:"grayscale",enabled:!0,amount:t};return this.filter(n)}sepia(t=1){let n={id:`sepia-${me()}`,type:"sepia",enabled:!0,amount:t};return this.filter(n)}outline(t={}){return this.filter({id:`outline-${me()}`,type:"outline",enabled:!0,width:t.width??3,color:t.color??"#000000",opacity:t.opacity??1,position:t.position??"outside"})}motionBlur(t={}){let n={id:`motion-blur-${me()}`,type:"motion-blur",enabled:!0,distance:t.distance??10,angle:t.angle??0,quality:t.quality??"normal"};return this.filter(n)}pointLight(t={}){let n={id:`point-light-${me()}`,type:"point-light",enabled:!0,x:t.x??100,y:t.y??100,z:t.z??200,color:t.color??"#ffffff",surfaceScale:t.surfaceScale??5,diffuseConstant:t.diffuseConstant??1,specularConstant:t.specularConstant??1,specularExponent:t.specularExponent??20};return this.filter(n)}spotLight(t={}){let n={id:`spot-light-${me()}`,type:"spot-light",enabled:!0,x:t.x??100,y:t.y??0,z:t.z??200,pointsAtX:t.pointsAtX??100,pointsAtY:t.pointsAtY??100,pointsAtZ:t.pointsAtZ??0,coneAngle:t.coneAngle??30,color:t.color??"#ffffff",surfaceScale:t.surfaceScale??5,specularConstant:t.specularConstant??1,specularExponent:t.specularExponent??20};return this.filter(n)}sharpen(t=1){let n={id:`sharpen-${me()}`,type:"sharpen",enabled:!0,amount:t};return this.filter(n)}pixelate(t=8){let n={id:`pixelate-${me()}`,type:"pixelate",enabled:!0,blockSize:t};return this.filter(n)}warp(t={}){let n={id:`warp-${me()}`,type:"warp",enabled:!0,scale:t.scale??10,frequency:t.frequency??.02,octaves:t.octaves??1,warpType:t.warpType??"turbulence"};return this.filter(n)}morphology(t={}){let n=t.radiusX??2,r=t.radiusY??n,i={id:`morphology-${me()}`,type:"morphology",enabled:!0,operator:t.operator??"dilate",radiusX:n,radiusY:r,linked:t.linked??n===r};return this.filter(i)}contouring(t={}){if((t.mode??"discrete")==="table"){let i={id:`contouring-table-${me()}`,type:"contouring-table",enabled:!0,levels:t.levels??4,contrast:t.contrast??1};return this.filter(i)}let r={id:`contouring-discrete-${me()}`,type:"contouring-discrete",enabled:!0,levels:t.levels??4};return this.filter(r)}roundEdges(t=4){let n={id:`round-edges-${me()}`,type:"round-edges",enabled:!0,radius:t};return this.filter(n)}channelPainter(t={}){let n={id:`channel-painter-${me()}`,type:"channel-painter",enabled:!0,red:t.red??1,green:t.green??1,blue:t.blue??1};return this.filter(n)}brightness(t=1){let n={id:`brightness-${me()}`,type:"brightness",enabled:!0,amount:t};return this.filter(n)}contrast(t=1){let n={id:`contrast-${me()}`,type:"contrast",enabled:!0,amount:t};return this.filter(n)}filterOpacity(t=1){let n={id:`opacity-${me()}`,type:"opacity",enabled:!0,amount:t};return this.filter(n)}invert(t=1){let n={id:`invert-${me()}`,type:"invert",enabled:!0,amount:t};return this.filter(n)}hueRotate(t=0){let n={id:`hue-rotate-${me()}`,type:"hue-rotate",enabled:!0,angle:t};return this.filter(n)}saturate(t=1){let n={id:`saturate-${me()}`,type:"saturate",enabled:!0,amount:t};return this.filter(n)}blackAndWhite(t=.5){let n={id:`black-and-white-${me()}`,type:"black-and-white",enabled:!0,threshold:t};return this.filter(n)}duotone(t={}){let n={id:`duotone-${me()}`,type:"duotone",enabled:!0,shadowColor:t.shadowColor??"#000000",highlightColor:t.highlightColor??"#ffffff"};return this.filter(n)}xray(t=1){let n={id:`xray-${me()}`,type:"xray",enabled:!0,intensity:t};return this.filter(n)}noise(t={}){let n={id:`noise-${me()}`,type:"noise",enabled:!0,amount:t.amount??.3,scale:t.scale??1};return this.filter(n)}emboss(t={}){let n={id:`emboss-${me()}`,type:"emboss",enabled:!0,strength:t.strength??1,angle:t.angle??135};return this.filter(n)}filmGrain(t={}){let n={id:`film-grain-${me()}`,type:"film-grain",enabled:!0,amount:t.amount??.3,size:t.size??1};return this.filter(n)}watercolor(t={}){let n={id:`watercolor-${me()}`,type:"watercolor",enabled:!0,wetness:t.wetness??.5,turbulence:t.turbulence??.5};return this.filter(n)}gouache(t={}){let n={id:`gouache-${me()}`,type:"gouache",enabled:!0,thickness:t.thickness??.5,texture:t.texture??.5};return this.filter(n)}inkBlot(t={}){let n={id:`ink-blot-${me()}`,type:"ink-blot",enabled:!0,spread:t.spread??.5,edges:t.edges??.5};return this.filter(n)}crumpledPlastic(t={}){let n={id:`crumpled-plastic-${me()}`,type:"crumpled-plastic",enabled:!0,wrinkles:t.wrinkles??.5,shine:t.shine??.5};return this.filter(n)}riddled(t={}){let n={id:`riddled-${me()}`,type:"riddled",enabled:!0,density:t.density??.5,size:t.size??1};return this.filter(n)}cssClipPath(t){return this._state.cssClipPath=t,this}cssMaskProperties(t){return this._state.cssMaskProperties=t,this}vectorEffect(t){return this._state.vectorEffect=t,this}transformBox(t){return this._state.transformBox=t,this}paintOrder(t){return this._state.paintOrder=t,this}blendMode(t){return this._state.blendMode=t,this}visibility(t){return this._state.visibility=t,this}shapeRendering(t){return this._state.shapeRendering=t,this}filterColorInterpolation(t){return this._state.filterColorInterpolation=t,this}inheritFill(t=!0){return this._state.inheritFill=t,this}inheritStroke(t=!0){return this._state.inheritStroke=t,this}systemLanguage(t){return this._state.systemLanguage=t,this}requiredExtensions(t){return this._state.requiredExtensions=t,this}fillLibrary(t,n="linear-gradient"){return this._state.fillLibraryId=t,this._state.fillType=n,this}strokeLibrary(t,n="linear-gradient"){return this._state.strokeLibraryId=t,this._state.strokeType=n,this}filterLibrary(...t){let n=this._state.filterLibraryIds??[];return this._state.filterLibraryIds=[...n,...t],this}markerStartRef(t){return this._state.markerStart=t,this}markerMidRef(t){return this._state.markerMid=t,this}markerEndRef(t){return this._state.markerEnd=t,this}bind(t,n){let r=this._state.bindings??{};return this._state.bindings={...r,[t]:n},this}metadata(t){return this._state.metadata={...this._state.metadata,...t},this}build(){return{id:this._id,type:this._type,state:{...this._state}}}},WS=class extends ln{constructor(t,n,r){if(r<0)throw new RangeError("Circle radius must be non-negative");super("circle"),this._state.x=t,this._state.y=n,this._state.radius=r}position(t,n){return this._state.x=t,this._state.y=n,this}radius(t){return this._state.radius=t,this}},XS=class extends ln{constructor(t,n,r,i){if(r<0||i<0)throw new RangeError("Ellipse radii must be non-negative");super("ellipse"),this._state.cx=t,this._state.cy=n,this._state.rx=r,this._state.ry=i}position(t,n){return this._state.cx=t,this._state.cy=n,this}radii(t,n){return this._state.rx=t,this._state.ry=n,this}},YS=class extends ln{constructor(t,n,r,i){if(r<0||i<0)throw new RangeError("Rectangle dimensions must be non-negative");super("rectangle"),this._state.x=t,this._state.y=n,this._state.width=r,this._state.height=i}position(t,n){return this._state.x=t,this._state.y=n,this}size(t,n){return this._state.width=t,this._state.height=n,this}cornerRadius(t){return this._state.cornerRadius=t,this._state.rx=t,this._state.ry=t,this}radii(t,n){return this._state.rx=t,this._state.ry=n,t===n&&(this._state.cornerRadius=t),this}},qS=class extends ln{constructor(t,n,r){if(r<0)throw new RangeError("Square size must be non-negative");super("square"),this._state.x=t,this._state.y=n,this._state.width=r,this._state.height=r}position(t,n){return this._state.x=t,this._state.y=n,this}size(t){return this._state.width=t,this._state.height=t,this}cornerRadius(t){return this._state.cornerRadius=t,this._state.rx=t,this._state.ry=t,this}radii(t,n){return this._state.rx=t,this._state.ry=n,t===n&&(this._state.cornerRadius=t),this}},ZS=class extends ln{constructor(t,n,r,i){super("line"),this._state.x1=t,this._state.y1=n,this._state.x2=r,this._state.y2=i}from(t,n){return this._state.x1=t,this._state.y1=n,this}to(t,n){return this._state.x2=t,this._state.y2=n,this}markerStart(t){return this._state.startEndpoint=t,this}markerEnd(t){return this._state.endEndpoint=t,this}markers(t,n){return this._state.startEndpoint=t,this._state.endEndpoint=n,this}},QS=class extends ln{constructor(t,n,r){super("text"),this._state.x=t,this._state.y=n,this._state.text=r}position(t,n){return this._state.x=t,this._state.y=n,this}content(t){return this._state.text=t,this}fontSize(t){return this._state.fontSize=t,this}fontFamily(t){return this._state.fontFamily=t,this}fontWeight(t){return this._state.fontWeight=t,this}fontStyle(t){return this._state.fontStyle=t,this}fontVariant(t){return this._state.fontVariant=t,this}fontVariantLigatures(t){return this._state.fontVariantLigatures=t,this}fontVariantPosition(t){return this._state.fontVariantPosition=t,this}fontVariantCaps(t){return this._state.fontVariantCaps=t,this}fontVariantNumeric(t){return this._state.fontVariantNumeric=t,this}fontVariantEastAsian(t){return this._state.fontVariantEastAsian=t,this}anchor(t){return this._state.textAnchor=t,this}letterSpacing(t){return this._state.letterSpacing=t,this}lineHeight(t){return this._state.lineHeight=t,this}decoration(t){return this._state.textDecoration=t,this}transform(t){return this._state.textTransform=t,this}textPath(t,n=0){return this._state.isTextPath=!0,this._state.textPathPoints=t,this._state.textPathStartOffset=n,this}textPathOffset(t){return this._state.textPathStartOffset=t,this}textPathSide(t){return this._state.textPathSide=t,this}direction(t){return this._state.textDirection=t,this}unicodeBidi(t){return this._state.unicodeBidi=t,this}dominantBaseline(t){return this._state.dominantBaseline=t,this}writingMode(t){return this._state.writingMode=t,this}wordSpacing(t){return this._state.wordSpacing=t,this}baselineShift(t){return this._state.baselineShift=t,this}inlineSize(t){return this._state.inlineSize=t,this}overflowWrap(t){return this._state.overflowWrap=t,this}whiteSpace(t){return this._state.whiteSpace=t,this}fontVariationSettings(t){return this._state.fontVariationSettings=t,this}charOffsets(t){return this._state.charOffsets=t,this}shapeInsideRef(t){return this._state.shapeInsideRef=t,this}shapePadding(t){return this._state.shapePadding=t,this}richTextSegments(t){return this._state.richTextRuns=Ei(t),this}richTextRuns(t){let n=ps(t);return this._state.richTextRuns=n,this}useRichText(t=!0){return this._state.useRichText=t,this}linePositions(t){return this._state.linePositions=t,this}textLength(t){return this._state.textLength=t,this}lengthAdjust(t){return this._state.lengthAdjust=t,this}},En=class extends ln{constructor(t,n,r,i){super(t),this._state.cx=n,this._state.cy=r,this._state.radius=i}position(t,n){return this._state.cx=t,this._state.cy=n,this}radius(t){return this._state.radius=t,this}shiftAngle(t){return this._state.shiftAngle=t,this}cornerRadius(t){return this._state.cornerRadius=t,this}},JS=class extends En{constructor(t,n,r){super("triangle",t,n,r)}},eb=class extends En{constructor(t,n,r,i=5){super("ngon",t,n,r),this._state.sides=i}sides(t){return this._state.sides=t,this}},tb=class extends En{constructor(t,n,r){super("star",t,n,r),this._state.arms=5,this._state.innerRadiusPercent=40}arms(t){return this._state.arms=t,this}innerRadius(t){return this._state.innerRadiusPercent=t,this}},nb=class extends En{constructor(t,n,r){super("cross",t,n,r),this._state.armWidthPercent=35}armWidth(t){return this._state.armWidthPercent=t,this}},rb=class extends En{constructor(t,n,r){super("ring",t,n,r),this._state.innerRadiusPercent=60}innerRadius(t){return this._state.innerRadiusPercent=t,this}},ib=class extends En{constructor(t,n,r){super("spiral",t,n,r),this._state.turns=3,this._state.thicknessPercent=15,this._state.spiralDirection=1}turns(t){return this._state.turns=t,this}thickness(t){return this._state.thicknessPercent=t,this}direction(t){return this._state.spiralDirection=t,this}},ob=class extends En{constructor(t,n,r){super("gear",t,n,r),this._state.teeth=8,this._state.toothDepthPercent=25}teeth(t){return this._state.teeth=t,this}toothDepth(t){return this._state.toothDepthPercent=t,this}holeRadius(t){return this._state.holeRadiusPercent=t,this}},sb=class extends En{constructor(t,n,r){super("arrow",t,n,r),this._state.headWidthPercent=100,this._state.headLengthPercent=35,this._state.shaftWidthPercent=35}headWidth(t){return this._state.headWidthPercent=t,this}headLength(t){return this._state.headLengthPercent=t,this}shaftWidth(t){return this._state.shaftWidthPercent=t,this}},ab=class extends En{constructor(t,n,r){super("heart",t,n,r),this._state.lobeRadiusPercent=50,this._state.cleftDepthPercent=25}lobeRadius(t){return this._state.lobeRadiusPercent=t,this}cleftDepth(t){return this._state.cleftDepthPercent=t,this}},cb=class extends En{constructor(t,n,r){super("lightning",t,n,r),this._state.boltSegments=3,this._state.boltJaggednessPercent=40,this._state.boltWidthPercent=30}segments(t){return this._state.boltSegments=t,this}jaggedness(t){return this._state.boltJaggednessPercent=t,this}thickness(t){return this._state.boltWidthPercent=t,this}},lb=class extends En{constructor(t,n,r){super("cloud",t,n,r),this._state.cloudBumps=5,this._state.cloudPuffinessPercent=60}bumps(t){return this._state.cloudBumps=t,this}puffiness(t){return this._state.cloudPuffinessPercent=t,this}},db=class extends En{constructor(t,n,r){super("speechBubble",t,n,r),this._state.tailAngleDeg=45,this._state.tailLengthPercent=40,this._state.tailWidthPercent=25}tailAngle(t){return this._state.tailAngleDeg=t,this}tailLength(t){return this._state.tailLengthPercent=t,this}tailWidth(t){return this._state.tailWidthPercent=t,this}},$o=class extends ln{add(t){let n="build"in t&&typeof t.build=="function"?t.build():t,r=this._state.children??[];return this._state.children=[...r,n],this}addAll(...t){for(let n of t)this.add(n);return this}children(t){return this._state.children=t.map(n=>"build"in n&&typeof n.build=="function"?n.build():n),this}},ub=class extends $o{constructor(t){super("hyperlink"),t!==void 0&&(this._state.href=t)}href(t){return this._state.href=t,this}hrefXlink(t){return this._state.hrefXlink=t,this}target(t){return this._state.linkTarget=t,this}download(t){return this._state.linkDownload=t,this}rel(t){return this._state.linkRel=t,this}ping(t){return this._state.linkPing=t,this}hreflang(t){return this._state.linkHreflang=t,this}type(t){return this._state.linkType=t,this}referrerPolicy(t){return this._state.linkReferrerPolicy=t,this}},fb=class extends $o{constructor(){super("switch")}},pb=class extends $o{constructor(){super("container")}},mb=class extends ln{constructor(t){super("view"),t&&(this._state.viewBoxX=t.x,this._state.viewBoxY=t.y,this._state.viewBoxWidth=t.width,this._state.viewBoxHeight=t.height)}viewBox(t,n,r,i){return this._state.viewBoxX=t,this._state.viewBoxY=n,this._state.viewBoxWidth=r,this._state.viewBoxHeight=i,this}name(t){return this._state.viewName=t,this}preserveAspectRatio(t){return this._state.viewPreserveAspectRatio=t,this}zoomAndPan(t){return this._state.viewZoomAndPan=t,this}viewTarget(t){return this._state.viewTarget=t,this}},gb=class extends $o{constructor(t=0,n=0,r=100,i=100){super("svg"),this._state.svgX=t,this._state.svgY=n,this._state.svgWidth=r,this._state.svgHeight=i}position(t,n){return this._state.svgX=t,this._state.svgY=n,this}size(t,n){return this._state.svgWidth=t,this._state.svgHeight=n,this}viewBox(t,n,r,i){return this._state.svgViewBoxX=t,this._state.svgViewBoxY=n,this._state.svgViewBoxWidth=r,this._state.svgViewBoxHeight=i,this}preserveAspectRatio(t){return this._state.svgPreserveAspectRatio=t,this}asRoot(t=!0){return this._state.isRootSvg=t,this}},hb=class extends ln{constructor(t){super("shape-reference"),t!==void 0&&(this._state.targetShapeId=t)}target(t){return this._state.targetShapeId=t,this}offset(t,n){return this._state.offsetX=t,this._state.offsetY=n,this}size(t,n){return this._state.width=t,this._state.height=n,this}},Cf=class extends ln{position(t,n){return this._state.x=t,this._state.y=n,this}size(t,n){return this._state.width=t,this._state.height=n,this}src(t){return this._state.href=t,this}mimeType(t){return this._state.mediaMimeType=t,this}naturalDuration(t){return this._state.naturalDuration=t,this}begin(t){return this._state.begin=t,this}trim(t,n){return this._state.trimStart=t,this._state.trimEnd=n,this}volume(t){return this._state.volume=t,this}muted(t=!0){return this._state.muted=t,this}loop(t=!0){return this._state.loop=t,this}playbackRate(t){return this._state.playbackRate=t,this}fade(t,n){return this._state.fadeInDuration=t,this._state.fadeOutDuration=n,this}language(t){return this._state.systemLanguage=t,this}},yb=class extends Cf{constructor(t){super("video"),this._state.mediaKind="video",t!==void 0&&(this._state.href=t)}poster(t){return this._state.posterHref=t,this}sourceRect(t){return this._state.sourceRect=t,this}},Sb=class extends Cf{constructor(t){super("audio"),this._state.mediaKind="audio",t!==void 0&&(this._state.href=t)}},bb=class extends ln{constructor(t=[]){super("path"),this._state.pathPoints=[...t],this._state.pathCurveType="cubic",this._state.pathClosed=!1}points(t){return this._state.pathPoints=[...t],this}addPoint(t,n){let r=this._state.pathPoints??[];return r.push({x:t,y:n}),this._state.pathPoints=r,this}curveType(t){return this._state.pathCurveType=t,this}closed(t=!0){return this._state.pathClosed=t,this}tension(t){return this._state.pathTension=t,this}arcParams(t){return this._state.pathArcParams=t,this}markerStart(t){return this._state.startEndpoint=t,this}markerEnd(t){return this._state.endEndpoint=t,this}markers(t,n){return this._state.startEndpoint=t,this._state.endEndpoint=n,this}toD(){let t=this._state.pathPoints??[],n=this._state.pathCurveType??"CUBIC",r=this._state.pathClosed??!1,i=this._state.pathTension??.5,o=this._state.pathArcParams;return pr(t,n,r,i,o)}},vb=class extends ln{constructor(t=[]){super("polyline"),this._state.polylinePoints=[...t],this._state.polylineClosed=!1}points(t){return this._state.polylinePoints=[...t],this}addPoint(t,n){let r=this._state.polylinePoints??[];return r.push({x:t,y:n}),this._state.polylinePoints=r,this}closed(t=!0){return this._state.polylineClosed=t,this}markerStart(t){return this._state.startEndpoint=t,this}markerEnd(t){return this._state.endEndpoint=t,this}markers(t,n){return this._state.startEndpoint=t,this._state.endEndpoint=n,this}},xb=class extends ln{constructor(t,n,r,i,o){super("image"),this._state.x=t,this._state.y=n,this._state.width=r,this._state.height=i,this._state.href=o}position(t,n){return this._state.x=t,this._state.y=n,this}size(t,n){return this._state.width=t,this._state.height=n,this}src(t){return this._state.href=t,this}preserveAspectRatio(t){return this._state.preserveAspectRatio=t,this}};var Af=class{_x1;_y1;_x2;_y2;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(t=0,n=0,r=1,i=0){this._x1=t,this._y1=n,this._x2=r,this._y2=i,this._id=me()}stop(t,n,r=1){return this._stops.push({offset:t,color:n,opacity:r}),this}direction(t,n,r,i){return this._x1=t,this._y1=n,this._x2=r,this._y2=i,this}spread(t){return this._spreadMethod=t,this}opacity(t){return this._opacity=t,this}build(){return{type:"linear-gradient",id:this._id,x1:this._x1,y1:this._y1,x2:this._x2,y2:this._y2,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},Nf=class{_cx=.5;_cy=.5;_fx=.5;_fy=.5;_r=.5;_ry=.5;_rotation=0;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(){this._id=me()}center(t,n){return this._cx=t,this._cy=n,this}focus(t,n){return this._fx=t,this._fy=n,this}radius(t,n){return this._r=t,this._ry=n??t,this}rotation(t){return this._rotation=t,this}stop(t,n,r=1){return this._stops.push({offset:t,color:n,opacity:r}),this}spread(t){return this._spreadMethod=t,this}opacity(t){return this._opacity=t,this}build(){return{type:"radial-gradient",id:this._id,cx:this._cx,cy:this._cy,fx:this._fx,fy:this._fy,r:this._r,ry:this._ry,rotation:this._rotation,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},Ef=class{_patternType;_color;_backgroundColor;_scale=1;_rotation=0;_opacity=1;_patternParams;_id;_svgContent;_width;_height;_patternUnits;_patternContentUnits;_patternTransform;_viewBox;_preserveAspectRatio;_x;_y;_customPatternId;constructor(t="stripes",n="#000000",r="#ffffff"){this._patternType=t,this._color=n,this._backgroundColor=r,this._id=me()}scale(t){return this._scale=t,this}rotation(t){return this._rotation=t,this}opacity(t){return this._opacity=t,this}params(t){return this._patternParams=t,this}svgContent(t){return this._svgContent=t,this}size(t,n){return this._width=t,this._height=n,this}patternUnits(t){return this._patternUnits=t,this}patternContentUnits(t){return this._patternContentUnits=t,this}patternTransform(t){return this._patternTransform=t,this}viewBox(t){return this._viewBox=t,this}preserveAspectRatio(t){return this._preserveAspectRatio=t,this}position(t,n){return this._x=t,this._y=n,this}customPatternId(t){return this._customPatternId=t,this}build(){let t,n,r;if(this._svgContent!==void 0)t=this._svgContent,n=this._width??10,r=this._height??10;else{let o=bg(this._patternType,this._scale,this._color,this._backgroundColor,this._patternParams);t=o.svgContent,n=this._width??o.width,r=this._height??o.height}let i={type:"pattern",id:this._id,patternType:this._svgContent!==void 0?"custom":this._patternType,color:this._color,backgroundColor:this._backgroundColor,scale:this._scale,rotation:this._rotation,opacity:this._opacity,svgContent:t,width:n,height:r,patternUnits:this._patternUnits??"userSpaceOnUse",patternParams:this._patternParams,patternTransform:this._patternTransform??(this._rotation?`rotate(${this._rotation})`:void 0)};return this._patternContentUnits&&(i.patternContentUnits=this._patternContentUnits),this._viewBox&&(i.viewBox=this._viewBox),this._preserveAspectRatio&&(i.preserveAspectRatio=this._preserveAspectRatio),this._x!==void 0&&(i.x=this._x),this._y!==void 0&&(i.y=this._y),this._customPatternId&&(i.customPatternId=this._customPatternId),i}};function g2(e=0,t=0,n=1,r=0){return new Af(e,t,n,r)}function h2(){return new Nf}function y2(e="stripes",t="#000000",n="#ffffff"){return new Ef(e,t,n)}var QR={rows:4,cols:4,style:"classic",tabDepthPercent:20,tabPattern:"random",seed:1},S2=.04,b2=0;function v2(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let n=t;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function xe(e){return Number(e.toFixed(3)).toString()}function x2(e,t,n,r,i,o,s,a,c,l,d,u){return[[0,0],[.2,a],[.5+c+d,-o+l],[.5-o+c,o+l],[.5-2*o+c-d,3*o+l],[.5+2*o+c-d,3*o+l],[.5+o+c,o+l],[.5+c+d,-o+l],[.8,u],[1,0]].map(([p,m])=>{let g=t+p*r,h=n+m*i*s;return e?{x:g,y:h}:{x:h,y:g}})}function XR(e,t,n,r,i,o,s,a,c,l,d){let u=[],f=(v,w)=>c==="alternating"?0:v+l()*(w-v),p=()=>l()<.5,m=f(-a,a),g=c==="alternating"?d%2===0:p(),h=null,y=m,S=f(-a,a),b=f(-a,a),I=f(-a,a);m=f(-a,a);for(let v=0;v<e;v++){v>0&&(h=g,g=c==="alternating"?(d+v)%2===0:p(),y=g===h?-m:m,S=f(-a,a),b=f(-a,a),I=f(-a,a),m=f(-a,a));let w=g?-1:1,k=n+v*i;u.push(x2(t,k,r,i,o,s,w,y,S,b,I,m))}return u}function YR(e,t,n,r,i,o,s){let a=2*o;return[[0,0],[.2,0],[.4,0],[.4,a],[.4,a],[.6,a],[.6,a],[.6,0],[.8,0],[1,0]].map(([l,d])=>{let u=t+l*r,f=n+d*i*s;return e?{x:u,y:f}:{x:f,y:u}})}function qR(e,t){return e+` C ${xe(t[1].x)} ${xe(t[1].y)} ${xe(t[2].x)} ${xe(t[2].y)} ${xe(t[3].x)} ${xe(t[3].y)} C ${xe(t[4].x)} ${xe(t[4].y)} ${xe(t[5].x)} ${xe(t[5].y)} ${xe(t[6].x)} ${xe(t[6].y)} C ${xe(t[7].x)} ${xe(t[7].y)} ${xe(t[8].x)} ${xe(t[8].y)} ${xe(t[9].x)} ${xe(t[9].y)}`}function ZR(e,t){return e+` C ${xe(t[8].x)} ${xe(t[8].y)} ${xe(t[7].x)} ${xe(t[7].y)} ${xe(t[6].x)} ${xe(t[6].y)} C ${xe(t[5].x)} ${xe(t[5].y)} ${xe(t[4].x)} ${xe(t[4].y)} ${xe(t[3].x)} ${xe(t[3].y)} C ${xe(t[2].x)} ${xe(t[2].y)} ${xe(t[1].x)} ${xe(t[1].y)} ${xe(t[0].x)} ${xe(t[0].y)}`}function I2(e,t={}){let n={...QR,...t};if(n.rows<1||n.cols<1)throw new Error("generatePuzzlePieces: rows and cols must be >= 1");if(!Number.isFinite(e.width)||!Number.isFinite(e.height))throw new Error("generatePuzzlePieces: bounds must have finite width/height");if(e.width<=0||e.height<=0)throw new Error("generatePuzzlePieces: bounds must have positive width/height");let{rows:r,cols:i,style:o,tabDepthPercent:s,tabPattern:a,seed:c}=n,l=v2(c),d=e.width/i,u=e.height/r,f=Math.max(0,Math.min(.4,s/200)),p=(o==="classic"||o==="curved")&&f>0,m=o==="square-tabs"&&f>0,g=o==="classic"&&a==="random"?S2:b2,h=[];for(let b=0;b<r-1;b++){let I=e.y+(b+1)*u;if(p)h.push(XR(i,!0,e.x,I,d,u,f,g,a,l,b));else if(m){let v=[];for(let w=0;w<i;w++){let k=a==="alternating"?(b+w)%2===0?1:-1:l()<.5?1:-1;v.push(YR(!0,e.x+w*d,I,d,u,f,k))}h.push(v)}else h.push(new Array(i).fill(null))}let y=[];for(let b=0;b<i-1;b++){let I=e.x+(b+1)*d;if(p)y.push(XR(r,!1,e.y,I,u,d,f,g,a,l,b));else if(m){let v=[];for(let w=0;w<r;w++){let k=a==="alternating"?(w+b)%2===0?1:-1:l()<.5?1:-1;v.push(YR(!1,e.y+w*u,I,u,d,f,k))}y.push(v)}else y.push(new Array(r).fill(null))}let S=[];for(let b=0;b<r;b++)for(let I=0;I<i;I++){let v=e.x+I*d,w=e.y+b*u,k=v+d,C=w+u,P=`M ${xe(v)} ${xe(w)}`;if(b===0)P+=` L ${xe(k)} ${xe(w)}`;else{let R=h[b-1][I];R?P=qR(P,R):P+=` L ${xe(k)} ${xe(w)}`}if(I===i-1)P+=` L ${xe(k)} ${xe(C)}`;else{let R=y[I][b];R?P=qR(P,R):P+=` L ${xe(k)} ${xe(C)}`}if(b===r-1)P+=` L ${xe(v)} ${xe(C)}`;else{let R=h[b][I];R?P=ZR(P,R):P+=` L ${xe(v)} ${xe(C)}`}if(I===0)P+=` L ${xe(v)} ${xe(w)}`;else{let R=y[I-1][b];R?P=ZR(P,R):P+=` L ${xe(v)} ${xe(w)}`}P+=" Z",S.push({id:`puzzle-${c}-r${b}-c${I}`,row:b,col:I,d:P})}return S}var tC=[1,2,3,4,5,6,7,8,9],w2={easy:{minGivens:40,maxGivens:45,maxRating:"singles"},medium:{minGivens:34,maxGivens:39,maxRating:"hidden-singles"},hard:{minGivens:28,maxGivens:33,maxRating:"search"},expert:{minGivens:24,maxGivens:27,maxRating:"search"}};function rl(e){return e.map(t=>[...t])}function k2(){return Array.from({length:9},()=>Array.from({length:9},()=>0))}function nC(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let n=t;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function rC(e,t){let n=[...e];for(let r=n.length-1;r>0;r--){let i=Math.floor(t()*(r+1));[n[r],n[i]]=[n[i],n[r]]}return n}function da(e){return 1<<e-1}function iC(e){let t=0,n=e;for(;n;)n&=n-1,t++;return t}function P2(e){for(let t=1;t<=9;t++)if(e===da(t))return t;return 0}function wb(e,t){return Math.floor(e/3)*3+Math.floor(t/3)}function Ib(e){let t=0;for(let n of e)for(let r of n)r!==0&&t++;return t}function T2(e){if(!Number.isFinite(e))return 1;let t=Math.floor(e);return t===0?1:t}function oC(e,t){if(!Array.isArray(e)||e.length!==9)return t.push("Grid must contain 9 rows."),!1;let n=!0;for(let r=0;r<9;r++){if(!Array.isArray(e[r])||e[r].length!==9){t.push(`Row ${r+1} must contain 9 cells.`),n=!1;continue}for(let i=0;i<9;i++){let o=e[r][i];(!Number.isInteger(o)||o<0||o>9)&&(t.push(`Cell R${r+1}C${i+1} must be a digit from 0 to 9.`),n=!1)}}return n}function sC(e,t){let n=!0,r=(i,o)=>{let s=0;for(let a of o){if(a===0)continue;let c=da(a);if(s&c){t.push(`${i} contains duplicate ${a}.`),n=!1;return}s|=c}};for(let i=0;i<9;i++)r(`Row ${i+1}`,e[i]);for(let i=0;i<9;i++)r(`Column ${i+1}`,e.map(o=>o[i]));for(let i=0;i<9;i+=3)for(let o=0;o<9;o+=3){let s=[];for(let a=i;a<i+3;a++)for(let c=o;c<o+3;c++)s.push(e[a][c]);r(`Box ${Math.floor(i/3)*3+Math.floor(o/3)+1}`,s)}return n}function kb(e){let t=Array.from({length:9},()=>0),n=Array.from({length:9},()=>0),r=Array.from({length:9},()=>0);for(let i=0;i<9;i++)for(let o=0;o<9;o++){let s=e[i][o];if(s===0)continue;let a=da(s),c=wb(i,o);if(t[i]&a||n[o]&a||r[c]&a)return null;t[i]|=a,n[o]|=a,r[c]|=a}return{rows:t,cols:n,boxes:r}}function Pb(e,t,n,r,i){return 511&~(n[e]|r[t]|i[wb(e,t)])}function aC(e,t,n){let r=kb(e);if(!r)return[];let i=rl(e),o=[],{rows:s,cols:a,boxes:c}=r,l=()=>{if(o.length>=t)return;let d=-1,u=-1,f=0,p=10;for(let g=0;g<9;g++){for(let h=0;h<9;h++){if(i[g][h]!==0)continue;let y=Pb(g,h,s,a,c),S=iC(y);if(S===0)return;if(S<p&&(d=g,u=h,f=y,p=S,S===1))break}if(p===1)break}if(d===-1){o.push(rl(i));return}let m=tC.filter(g=>f&da(g));n&&(m=rC(m,n));for(let g of m){let h=da(g),y=wb(d,u);if(i[d][u]=g,s[d]|=h,a[u]|=h,c[y]|=h,l(),c[y]&=~h,a[u]&=~h,s[d]&=~h,i[d][u]=0,o.length>=t)return}};return l(),o}function R2(e){let t=k2(),n=nC(e),[r]=aC(t,1,n);if(!r)throw new Error("generateSudokuPuzzle: failed to generate solved grid");return r}function C2(e){let t=kb(e);if(!t)return null;for(let n=0;n<9;n++)for(let r=0;r<9;r++){if(e[n][r]!==0)continue;let i=Pb(n,r,t.rows,t.cols,t.boxes);if(iC(i)===1)return{row:n,col:r,value:P2(i)}}return null}function A2(e){let t=kb(e);if(!t)return null;let n=r=>{for(let i of tC){let o=da(i),s=null;for(let a of r)if(!(e[a.row][a.col]!==0||!(Pb(a.row,a.col,t.rows,t.cols,t.boxes)&o))){if(s){s=null;break}s=a}if(s)return{...s,value:i}}return null};for(let r=0;r<9;r++){let i=n(Array.from({length:9},(o,s)=>({row:r,col:s})));if(i)return i}for(let r=0;r<9;r++){let i=n(Array.from({length:9},(o,s)=>({row:s,col:r})));if(i)return i}for(let r=0;r<9;r+=3)for(let i=0;i<9;i+=3){let o=[];for(let a=r;a<r+3;a++)for(let c=i;c<i+3;c++)o.push({row:a,col:c});let s=n(o);if(s)return s}return null}function JR(e){let t=rl(e),n=!1;for(;Ib(t)<81;){let r=C2(t);if(r){t[r.row][r.col]=r.value;continue}let i=A2(t);if(i){n=!0,t[i.row][i.col]=i.value;continue}return"search"}return n?"hidden-singles":"singles"}function eC(e,t){let n={singles:0,"hidden-singles":1,search:2};return n[e]<=n[t]}function Of(e,t={}){let n=[];return oC(e,n)?sC(e,n)?aC(e,Math.max(1,Math.floor(t.maxSolutions??2))):[]:[]}function N2(e){let t=[];if(!oC(e,t))return{valid:!1,unique:!1,solution:null,errors:t};if(sC(e,t),t.length>0)return{valid:!1,unique:!1,solution:null,errors:t};let r=Of(e,{maxSolutions:2});return r.length===0?t.push("Puzzle has no solution."):r.length>1&&t.push("Puzzle has more than one solution."),{valid:t.length===0,unique:r.length===1,solution:r[0]?rl(r[0]):null,errors:t}}function E2(e){let t=e.difficulty,n=w2[t];if(!n)throw new Error(`generateSudokuPuzzle: unsupported difficulty "${t}"`);let r=T2(e.seed);for(let i=0;i<30;i++){let o=r+i*104729>>>0,s=nC(o),a=R2(o),c=rl(a),l=n.minGivens+Math.floor(s()*(n.maxGivens-n.minGivens+1)),d=rC(Array.from({length:81},(m,g)=>({row:Math.floor(g/9),col:g%9})),s);for(let m of d){if(Ib(c)<=l)break;let g=c[m.row][m.col];if(c[m.row][m.col]=0,Of(c,{maxSolutions:2}).length!==1){c[m.row][m.col]=g;continue}let y=JR(c);eC(y,n.maxRating)||(c[m.row][m.col]=g)}let u=Ib(c),f=JR(c);if(Of(c,{maxSolutions:2}).length===1&&u>=n.minGivens&&u<=n.maxGivens&&eC(f,n.maxRating))return{puzzle:c,solution:a,difficulty:t,seed:r,givens:u,rating:f}}throw new Error(`generateSudokuPuzzle: unable to generate a ${t} puzzle`)}var cC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var O2={E:{direction:"E",dr:0,dc:1},S:{direction:"S",dr:1,dc:0},SE:{direction:"SE",dr:1,dc:1},NE:{direction:"NE",dr:-1,dc:1},W:{direction:"W",dr:0,dc:-1},N:{direction:"N",dr:-1,dc:0},NW:{direction:"NW",dr:-1,dc:-1},SW:{direction:"SW",dr:1,dc:-1}};function dC(e){if(!Number.isFinite(e))return 1;let t=Math.floor(e);return t===0?1:t}function uC(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let n=t;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function ua(e){let t=globalThis.Intl.Segmenter;return t?Array.from(new t(void 0,{granularity:"grapheme"}).segment(e),n=>n.segment.normalize("NFC")):Array.from(e.normalize("NFC"))}function D2(e,t,n,r){return e>=0&&t>=0&&e<r&&t<n}function Tb(e,t){return Array.from({length:t},()=>Array.from({length:e},()=>!0))}function fC(e,t,n,r){if(!n)return Tb(e,t);if(!Array.isArray(n)||n.length!==t)return r.push(`Mask must contain exactly ${t} rows.`),Tb(e,t);let i=[];for(let o=0;o<t;o++){if(!Array.isArray(n[o])||n[o].length!==e)return r.push(`Mask row ${o+1} must contain exactly ${e} cells.`),Tb(e,t);i.push(n[o].map(Boolean))}return i}function $2(e){let t=0;for(let n of e)for(let r of n)r&&t++;return t}function M2(e){return e.trim().normalize("NFC")}function z2(e){return e.replace(/\r/g,"").split(/[,\n]+/).map(t=>t.trim()).filter(t=>t.length>0)}function pC(e,t){let n=[];return e.across&&(n.push("E"),t&&n.push("W")),e.down&&(n.push("S"),t&&n.push("N")),e.diagonal&&(n.push("SE","NE"),t&&n.push("NW","SW")),n}function F2(e,t,n,r,i,o,s,a){let c=ua(e),l=[];for(let d=0;d<c.length;d++){let u=t+r.dr*d,f=n+r.dc*d;if(!D2(u,f,o,s)||!i[u][f])return null;l.push({row:u,col:f,grapheme:c[d]})}return{word:e,graphemes:c,row:t,col:n,direction:r.direction,dr:r.dr,dc:r.dc,cells:l,jitter:a}}function mC(e,t,n,r,i,o){let s=[];for(let a of t){let c=O2[a];for(let l=0;l<i;l++)for(let d=0;d<r;d++){let u=F2(e,l,d,c,n,r,i,o());u&&s.push(u)}}return s}function gC(e){let t=[],n=[],r=[],i=Math.floor(e.width),o=Math.floor(e.height);(!Number.isInteger(i)||i<2||i>64)&&t.push("Width must be an integer from 2 to 64."),(!Number.isInteger(o)||o<2||o>64)&&t.push("Height must be an integer from 2 to 64.");let s=pC(e.axes,e.allowBackwards);s.length===0&&t.push("At least one word direction must be enabled.");let a=fC(Math.max(1,i),Math.max(1,o),e.mask,t),c=$2(a);c===0&&t.push("Mask must contain at least one active cell.");let l=new Set,d=[];for(let p of e.words){let m=M2(p);if(m){if(/\s/u.test(m)){r.push({input:p,reason:"Words cannot contain whitespace."});continue}if(l.has(m)){r.push({input:p,reason:"Duplicate word."});continue}l.add(m),d.push(m)}}d.length===0&&t.push("Enter at least one word.");let u=uC(dC(e.seed));if(t.length===0)for(let p=d.length-1;p>=0;p--){let m=d[p];mC(m,s,a,i,o,u).length===0&&(r.push({input:m,reason:"No legal placement exists for the current size, mask, and directions."}),d.splice(p,1))}r.length>0&&t.push(`${r.length} word${r.length===1?"":"s"} rejected.`);let f=Math.max(0,c);return d.length>f&&n.push("The word count exceeds the active cell count; overlaps may be required for this puzzle."),{valid:t.length===0,acceptedWords:d,rejectedWords:r,errors:t,warnings:n,minWords:1,maxWords:f,activeCells:c,directions:s}}function L2(e,t){for(let n of t.cells){let r=e[n.row][n.col];if(r!==null&&r!==n.grapheme)return!0}return!1}function _2(e,t){let n=[];for(let r of t.cells)e[r.row][r.col]===null&&(n.push({row:r.row,col:r.col}),e[r.row][r.col]=r.grapheme);return n}function B2(e,t){for(let n of t)e[n.row][n.col]=null}function lC(e,t){let n=0;for(let r of t.cells)e[r.row][r.col]===r.grapheme&&n++;return n}function V2(e){return{word:e.word,row:e.row,col:e.col,direction:e.direction,path:e.cells.map(t=>({...t}))}}function G2(e){let t=e.fillerAlphabet??cC,n=typeof t=="string"?ua(t):t.flatMap(i=>ua(i)),r=n.filter((i,o)=>i.trim()&&n.indexOf(i)===o);return r.length>0?r:ua(cC)}function j2(e){let t=Math.floor(e.width),n=Math.floor(e.height),r=dC(e.seed),i=gC({...e,width:t,height:n,seed:r});if(!i.valid)throw new Error(`generateWordSearch: ${i.errors[0]??"invalid options"}`);let o=fC(t,n,e.mask,[]),s=Math.max(1,Math.floor(e.maxBacktrackNodes??15e4));for(let a=0;a<24;a++){let c=uC(r+a*104729>>>0),l=i.directions,d=new Map;for(let S of i.acceptedWords)d.set(S,mC(S,l,o,t,n,c));let u=[...i.acceptedWords].sort((S,b)=>{let I=d.get(S)?.length??0,v=d.get(b)?.length??0;return I!==v?I-v:ua(b).length-ua(S).length}),f=Array.from({length:n},(S,b)=>Array.from({length:t},(I,v)=>o[b][v]?null:"")),p=[],m=new Map,g=0,h=S=>{if(++g>s)return!1;if(S>=u.length)return!0;let b=u[S],I=[...d.get(b)??[]].filter(v=>!L2(f,v)).sort((v,w)=>{let k=lC(f,w)-lC(f,v);if(k!==0)return k;let C=(m.get(v.direction)??0)-(m.get(w.direction)??0);return C!==0?C:v.jitter-w.jitter});for(let v of I){let w=_2(f,v);if(p.push(V2(v)),m.set(v.direction,(m.get(v.direction)??0)+1),h(S+1))return!0;m.set(v.direction,(m.get(v.direction)??1)-1),p.pop(),B2(f,w)}return!1};if(!h(0))continue;let y=G2(e);for(let S=0;S<n;S++)for(let b=0;b<t;b++)o[S][b]?f[S][b]===null&&(f[S][b]=y[Math.floor(c()*y.length)]):f[S][b]="";return{width:t,height:n,grid:f,mask:o.map(S=>[...S]),normalizedWords:[...i.acceptedWords],placements:[...p],seed:r,title:e.title,creator:e.creator,lint:i}}throw new Error("generateWordSearch: unable to place all words with the current settings")}function U2(e,t,n){let r=!1;for(let i=0,o=n.length-1;i<n.length;o=i++){let s=n[i],a=n[o];s.y>t!=a.y>t&&e<(a.x-s.x)*(t-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function H2(){let e=[];for(let t=0;t<10;t++){let n=t%2===0?.5:.23,r=-Math.PI/2+t*Math.PI/5;e.push({x:.5+Math.cos(r)*n,y:.5+Math.sin(r)*n})}return e}function K2(e,t,n){let r=Math.max(1,Math.floor(e)),i=Math.max(1,Math.floor(t)),o=H2();return Array.from({length:i},(s,a)=>Array.from({length:r},(c,l)=>{let d=(l+.5)/r,u=(a+.5)/i,f=d*2-1,p=u*2-1;switch(n){case"rectangle":return!0;case"circle":return f*f+p*p<=1;case"triangle":return u>=.08&&u<=.95&&Math.abs(f)<=u;case"diamond":return Math.abs(f)+Math.abs(p)<=1;case"star":return U2(d,u,o);case"heart":{let m=f*1.25,g=-p*1.25;return Math.pow(m*m+g*g-1,3)-m*m*g*g*g<=0}case"cross":return Math.abs(f)<=.32||Math.abs(p)<=.32;default:return!0}}))}function Df(e,t){let{width:n,height:r,data:i}=e;if(!Number.isInteger(n)||!Number.isInteger(r)||n<0||r<0)throw new Error(`${t}: image dimensions must be non-negative integers, got ${n}x${r}`);if(i.length!==n*r*4)throw new Error(`${t}: data length ${i.length} does not match ${n}x${r} RGBA (${n*r*4})`)}function Ab(e,t,n){return .2126*e+.7152*t+.0722*n}function Rb(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}var W2=.95047,X2=1,Y2=1.08883,q2=Math.pow(6/29,3),Z2=1/(3*Math.pow(6/29,2));function Cb(e){return e>q2?Math.cbrt(e):e*Z2+4/29}function $f(e,t,n,r){let i=Rb(e),o=Rb(t),s=Rb(n),a=.4124564*i+.3575761*o+.1804375*s,c=.2126729*i+.7151522*o+.072175*s,l=.0193339*i+.119192*o+.9503041*s,d=Cb(a/W2),u=Cb(c/X2),f=Cb(l/Y2);r[0]=116*u-16,r[1]=500*(d-u),r[2]=200*(u-f)}var Yi=Math.PI/180,hC=Math.pow(25,7);function Nb(e,t,n,r,i,o){let s=Math.hypot(t,n),a=Math.hypot(i,o),c=(s+a)/2,l=Math.pow(c,7),d=.5*(1-Math.sqrt(l/(l+hC))),u=(1+d)*t,f=(1+d)*i,p=Math.hypot(u,n),m=Math.hypot(f,o),g=p===0?0:(Math.atan2(n,u)/Yi+360)%360,h=m===0?0:(Math.atan2(o,f)/Yi+360)%360,y=r-e,S=m-p,b=0;p*m!==0&&(b=h-g,b>180?b-=360:b<-180&&(b+=360));let I=2*Math.sqrt(p*m)*Math.sin(b/2*Yi),v=(e+r)/2,w=(p+m)/2,k;if(p*m===0)k=g+h;else{let V=g+h;Math.abs(g-h)<=180?k=V/2:V<360?k=(V+360)/2:k=(V-360)/2}let C=1-.17*Math.cos((k-30)*Yi)+.24*Math.cos(2*k*Yi)+.32*Math.cos((3*k+6)*Yi)-.2*Math.cos((4*k-63)*Yi),P=30*Math.exp(-Math.pow((k-275)/25,2)),R=Math.pow(w,7),N=2*Math.sqrt(R/(R+hC)),M=Math.pow(v-50,2),A=1+.015*M/Math.sqrt(20+M),$=1+.045*w,_=1+.015*w*C,z=-Math.sin(2*P*Yi)*N,j=y/A,G=S/$,W=I/_;return Math.sqrt(j*j+G*G+W*W+z*G*W)}function Eb(e,t){return e.width===t.width&&e.height===t.height}function Mf(e){let t=e.data,n=new Uint8ClampedArray(t.length);for(let r=0;r<t.length;r+=4){let i=t[r+3];if(n[r+3]=i,i===255)n[r]=t[r],n[r+1]=t[r+1],n[r+2]=t[r+2];else if(i!==0){let o=i/255;n[r]=Math.round(t[r]*o),n[r+1]=Math.round(t[r+1]*o),n[r+2]=Math.round(t[r+2]*o)}}return n}function zf(e,t){let n=e.data,r=e.width*e.height,i=new Uint8ClampedArray(r*3);for(let o=0;o<r;o++){let s=o*4,a=o*3,c=n[s+3]/255;if(c===1)i[a]=n[s],i[a+1]=n[s+1],i[a+2]=n[s+2];else if(c===0)i[a]=t.r,i[a+1]=t.g,i[a+2]=t.b;else{let l=1-c;i[a]=Math.round(n[s]*c+t.r*l),i[a+1]=Math.round(n[s+1]*c+t.g*l),i[a+2]=Math.round(n[s+2]*c+t.b*l)}}return i}var yC=6.502500000000001,SC=(.03*255)**2;function Q2(e,t){let n=new Float64Array(e*2+1),r=0;for(let i=-e;i<=e;i++){let o=Math.exp(-(i*i)/(2*t*t));n[i+e]=o,r+=o}for(let i=0;i<n.length;i++)n[i]/=r;return n}function il(e,t,n,r,i,o,s){for(let a=0;a<n;a++){let c=a*t;for(let l=0;l<t;l++){let d=0;for(let u=-i;u<=i;u++){let f=l+u;f<0?f=0:f>=t&&(f=t-1),d+=e[c+f]*r[u+i]}o[c+l]=d}}for(let a=0;a<n;a++)for(let c=0;c<t;c++){let l=0;for(let d=-i;d<=i;d++){let u=a+d;u<0?u=0:u>=n&&(u=n-1),l+=o[u*t+c]*r[d+i]}s[a*t+c]=l}}function Ff(e,t,n,r){if(e.length!==n*r||t.length!==n*r)throw new Error(`ssimPlane: plane length ${e.length}/${t.length} does not match ${n}x${r}`);let i=Math.min(n,r);if(i<3){for(let I=0;I<e.length;I++)if(e[I]!==t[I])return 0;return 1}let o=11;i<o&&(o=i%2===0?i-1:i);let s=(o-1)/2,a=Q2(s,1.5),c=n*r,l=new Float64Array(c),d=new Float64Array(c),u=new Float64Array(c);for(let I=0;I<c;I++)l[I]=e[I]*e[I],d[I]=t[I]*t[I],u[I]=e[I]*t[I];let f=new Float64Array(c),p=new Float64Array(c),m=new Float64Array(c),g=new Float64Array(c),h=new Float64Array(c),y=new Float64Array(c);il(e,n,r,a,s,f,p),il(t,n,r,a,s,f,m),il(l,n,r,a,s,f,g),il(d,n,r,a,s,f,h),il(u,n,r,a,s,f,y);let S=0,b=0;for(let I=s;I<r-s;I++)for(let v=s;v<n-s;v++){let w=I*n+v,k=p[w],C=m[w],P=k*k,R=C*C,N=g[w]-P,M=h[w]-R,A=y[w]-k*C,$=(2*k*C+yC)*(2*A+SC),_=(P+R+yC)*(N+M+SC);S+=$/_,b++}return b>0?S/b:1}function Ob(e,t,n,r={}){let i=t*n;if(e.length!==i)throw new Error(`severity: field length ${e.length} does not match ${t}x${n}`);let o=r.threshold??2,s=r.minNeighbours??4,a=new Uint8Array(i),c=0;for(let h=0;h<i;h++)e[h]>o&&(a[h]=1,c++);if(c===0)return{differing:0,coherent:0,clusters:0,largestCluster:0,mass:0,score:1};let l=new Uint8Array(i),d=0;for(let h=0;h<n;h++){let y=h*t;for(let S=0;S<t;S++){if(!a[y+S])continue;let b=0;for(let I=-1;I<=1;I++){let v=h+I;if(v<0||v>=n)continue;let w=v*t;for(let k=-1;k<=1;k++){if(k===0&&I===0)continue;let C=S+k;C<0||C>=t||(b+=a[w+C])}}b>=s&&(l[y+S]=1,d++)}}let u=0,f=0,p=0,m=[];for(let h=0;h<i;h++){if(!l[h])continue;u++;let y=0;for(l[h]=0,m.push(h);m.length>0;){let S=m.pop();y++;let b=S%t;b>0&&l[S-1]&&(l[S-1]=0,m.push(S-1)),b+1<t&&l[S+1]&&(l[S+1]=0,m.push(S+1)),S>=t&&l[S-t]&&(l[S-t]=0,m.push(S-t)),S+t<i&&l[S+t]&&(l[S+t]=0,m.push(S+t))}y>f&&(f=y),p+=y*y}let g=i===0?0:Math.min(1,Math.sqrt(p)/i);return{differing:c,coherent:d,clusters:u,largestCluster:f,mass:g,score:1-g}}var J2={r:255,g:255,b:255,a:255};function eH(e,t,n={}){if(Df(e,"compareImages(reference)"),Df(t,"compareImages(candidate)"),!Eb(e,t))throw new Error(`compareImages: cannot compare ${e.width}x${e.height} against ${t.width}x${t.height}`);let r=n.alphaMode??"premultiplied",i=n.deltaEBackground??J2,o=r==="premultiplied"?Mf(e):e.data,s=r==="premultiplied"?Mf(t):t.data,a=e.width,c=e.height,l=a*c,d=0,u=0,f=0;for(let v=0;v<l;v++){let w=v*4,k=o[w]-s[w],C=o[w+1]-s[w+1],P=o[w+2]-s[w+2],R=o[w+3]-s[w+3];if(d+=k*k+C*C+P*P+R*R,k===0&&C===0&&P===0&&R===0)u++;else{let N=Math.max(Math.abs(k),Math.abs(C),Math.abs(P),Math.abs(R));N>f&&(f=N)}}let p=l===0?0:d/(l*4),m=p===0?1/0:10*Math.log10(65025/p),g=u===l,h=1,y=1;if(!g&&!n.skipSsim){let v=bC(o,l),w=bC(s,l),k=0;for(let C=0;C<3;C++)k+=Ff(v.rgb[C],w.rgb[C],a,c);h=k/3,y=Ff(v.luma,w.luma,a,c)}let S={mean:0,p95:0,max:0},b=n.severity&&!g?new Float64Array(l):void 0;!g&&!n.skipDeltaE&&(S=tH(e,t,i,b));let I;return n.severity&&(I=g?{differing:0,coherent:0,clusters:0,largestCluster:0,mass:0,score:1}:Ob(b??new Float64Array(l),a,c)),{width:a,height:c,pixels:l,exactPixels:u,exactRatio:l===0?1:u/l,maxChannelDiff:f,mse:p,rmse:Math.sqrt(p),psnr:m,ssim:h,ssimLuma:y,deltaE:S,deltaEBackground:i,alphaMode:r,lossless:g,severity:I}}function bC(e,t){let n=new Float64Array(t),r=new Float64Array(t),i=new Float64Array(t),o=new Float64Array(t);for(let s=0;s<t;s++){let a=s*4;n[s]=e[a],r[s]=e[a+1],i[s]=e[a+2],o[s]=Ab(e[a],e[a+1],e[a+2])}return{rgb:[n,r,i],luma:o}}function tH(e,t,n,r){let i=zf(e,n),o=zf(t,n),s=e.width*e.height,a=10001,c=new Uint32Array(a),l=new Float64Array(3),d=new Float64Array(3),u=0,f=0;for(let h=0;h<s;h++){let y=h*3,S=i[y],b=i[y+1],I=i[y+2],v=o[y],w=o[y+1],k=o[y+2];if(S===v&&b===w&&I===k){c[0]++;continue}$f(S,b,I,l),$f(v,w,k,d);let C=Nb(l[0],l[1],l[2],d[0],d[1],d[2]);r&&(r[h]=C),u+=C,C>f&&(f=C),c[Math.min(a-1,Math.round(C*100))]++}let p=Math.ceil(s*.95),m=0,g=0;for(let h=0;h<a;h++)if(m+=c[h],m>=p){g=h/100;break}return{mean:s===0?0:u/s,p95:g,max:f}}export{Jf as ANIMATION_MANAGER_INTERPOLATION_POLICY,sb as Arrow,Sb as Audio,Yb as BASE_FILL_LAYER_ID,qb as BASE_STROKE_LAYER_ID,tD as BROWSER_SVG_EXTENSION_URIS,zs as BUILTIN_MARKER_ID_MAP,Xj as CANONICAL_NORMALIZATION_FAULT_POINTS,ho as CC_NS,Hj as COLLAB_PROTOCOL_VERSION,kt as COMMON_PROP_DEFAULTS,Hb as COMMON_TRANSFORM_NODE_DEFAULTS,ny as CONNECTOR_LABEL_BASELINE_LIFT,ty as CONNECTOR_LABEL_FONT_FAMILY,ey as CONNECTOR_LABEL_FONT_SIZE,hk as CSS_GENERIC_FAMILY_NAMES,Tn as CURRENT_SCHEMA_VERSION,ia as CanonicalDocument,WS as Circle,lb as Cloud,pb as Container,$o as ContainerShapeBuilder,nb as Cross,_n as DC_NS,Au as DEFAULT_CONNECTOR_CORNER_RADIUS,L0 as DEFAULT_CONNECTOR_LABEL_OFFSET,F0 as DEFAULT_CONNECTOR_LABEL_POSITION,Ds as DEFAULT_COORDINATE_PRECISION,ru as DEFAULT_FONT_WEIGHT,fs as DEFAULT_RICH_TEXT_STYLE,nj as DOCUMENT_BYTE_KINDS,pn as DOCUMENT_FIELDS,lS as DOCUMENT_FIELD_LIVE_AUTHORITY,Ox as DOCUMENT_IMPORT_INTENTS,rj as DOCUMENT_IMPORT_KINDS,sd as DOCUMENT_INGEST_POLICIES,Yp as DOCUMENT_SECTION_ORDER,US as DocumentBuilder,Oo as DocumentModel,pS as DocumentSession,to as EASING_CURVES,Er as EasingType,XS as Ellipse,Zn as FLOWCHART_GEOMETRY_DEFAULTS,LC as GEOMETRY_TRACK_PROPERTIES,ob as Gear,Ek as HEADLESS_SVG_STYLE_ENVIRONMENT,ab as Heart,ub as Hyperlink,Ke as IDENTITY_AFFINE,eO as INGEST_APPLY_STAGES,GE as INGEST_DIAGNOSTIC_CODES,lo as INGEST_DOCUMENT_ROOT_IDENTITY,rd as INGEST_FEATURES,Wp as INGEST_FEATURE_CAPABILITIES,is as INGEST_PLAN_VERSION,za as INGRESS_INTENTS,KH as INITIAL_ROOT_FONT_SIZE,lf as INLINE_CHILD_CONTAINER_TYPES,xb as ImageShape,dd as IngestApplicationError,Qd as KNOWN_METADATA_PREFIXES,t0 as KNOWN_STATE_KEYS,mS as LAYER_PRESENTATION_IDS,dS as LIBRARY_ASSEMBLY_KIND_ORDER,_c as LIBRARY_EMIT_ORDER,lH as LIBRARY_KINDS,cb as Lightning,ZS as Line,Af as LinearGradientBuilder,Hh as MARKER_HEIGHT,wu as MARKER_VIEWBOX,Uh as MARKER_WIDTH,nI as MATHML_EXTENSION_URI,ji as MAX_COORDINATE_PRECISION,b0 as MIGRATIONS,um as NAMESPACE_VOCABULARIES,eb as NGon,oG as NON_RENDERING_LIBRARY_KINDS,B1 as NON_WIRE_PROP_KEYS,ul as NUMERIC_SHAPE_TRANSFORM_STATE_KEYS,gb as NestedSvg,uu as NodeSchemaRegistry,hu as PAINT_SERVER_PASSTHROUGH_ATTR,Vb as PATH_DATA_TRACK_PROPERTIES,Vt as POLYGON_GEOMETRY_DEFAULTS,di as PRESENTATION_SEMANTICS,QR as PUZZLE_DEFAULTS,bb as Path,Gb as PathCurveType,_C as PathPointType,Ef as PatternBuilder,vb as Polyline,Is as RDF_NS,jh as RENDER_DIAGNOSTIC_CODES,zB as RENDER_FEATURES,FB as RENDER_FEATURE_CAPABILITIES,HE as RENDER_TARGETS,Ya as RICH_TEXT_STYLE_KEYS,Nf as RadialGradientBuilder,YS as Rectangle,rb as Ring,ud as SAXES_SVG_XML_PARSER_HOST,iF as SCRIPT_ANIMATION_GENERATORS,jb as SERIALIZED_SHAPE_STATE_KEYS,KE as SHAPE_ENVELOPE_KEYS,We as SHAPE_GEOMETRY_DEFAULTS,Ub as SHAPE_TRANSFORM_STATE_KEYS,go as SVGSKETCH_NS,NN as SVGSKETCH_PATH_EXTENSIONS,mm as SVG_CONDITIONAL_PROCESSING_ATTRIBUTES,sI as SVG_IMPORT_CAPABILITY_OWNERS,te as SVG_NAMESPACE,_L as SVG_NS,ed as SVG_PRESENTATION_PROPERTIES,MP as SVG_WELL_KNOWN_NAMESPACE_URIS,Ao as SceneGraph,ar as SceneNode,ln as ShapeBuilder,hb as ShapeReference,db as SpeechBubble,ib as Spiral,qS as Square,tb as Star,ef as SvgImportError,Ri as SvgSourceDecodingError,Ga as SvgXmlParserHostError,fb as Switch,Km as TEXT_PATH_GENERATED_ID_PREFIX,Jd as TYPED_FIELD_PREDICATES,QS as Text,Ru as TextLayoutEngine,KS as Timeline,HS as Track,JS as Triangle,bl as VARIANT_INTERPOLATION_POLICY,yb as Video,mb as View,gS as WRAPPER_PRESENTATION_IDS,tI as XHTML_EXTENSION_URI,LH as accumulateAnimationValue,FH as addAnimationValues,Ql as addSmilPointsValues,Qt as affine,Al as affineFromArray,Ct as affineToArray,XH as almostEqualAffine,kv as animationBackwardsFillTrack,xv as animationCycleDuration,Or as animationDefinitionTargetShapeId,wv as animationTrackActiveEnd,Iv as animationTrackDocumentBegin,no as appearanceLayers,Xf as appendAppearanceLayer,qe as applyAffineToPoint,op as applyAffineToVector,ZC as applyAppearanceStyle,Bi as applyClipMaskGroupDelta,BR as applyClipMaskPlanToShapes,Cv as applyCssAnimationLonghandOverrides,sf as applyGuideDeltaOp,oO as applyIngestPlan,af as applyMeasurementDeltaOp,Ej as applyMetadataDeltaOp,cS as applyOpToSnapshot,lR as applyOpsInPlace,jj as applyOpsToSnapshot,dR as applyOpsToSnapshotWithAccepted,lP as applyPathNodeValue,Pd as applyRichTextFormat,Mm as applyTextSplice,Ui as applyTextTransform,nv as applyTimingFunctionToKeyframe,Xl as arcEndpointToCenter,Dc as areTracksTimingEquivalent,Ol as around,pR as assembleLibraryDefs,UR as assembleSvgFromPlan,UE as assertIngestFeatureRegistry,Mx as assertIngestPolicyRegistry,eD as assertNamespaceVocabularyRegistry,Df as assertRasterImage,pD as assertSvgImportCapabilityOwners,xR as authoredPaintDeclarations,Hf as baseFillLayer,Kf as baseStrokeLayer,Iy as buildCompoundTransformValues,br as buildDefinitionPlacementIndex,aj as buildForeignImportReport,Ag as buildFreshMetadataBlock,Cj as buildGuideDeltaOps,Eg as buildManagedChildren,ek as buildManagedDescription,Aj as buildMeasurementDeltaOps,Nj as buildMetadataDeltaOps,Rr as buildRenderPlan,or as buildSmilKeyframeData,gr as buildSmilKeyframes,q6 as buildSvgDestinationIdentityIndex,tj as buildSvgIngestPlan,SS as buildSymbolMaterializationPlan,ky as buildViewBoxSmilKeyframeData,Bv as canonicalPolygonTransformString,ur as canonicalTransformMatrix,fn as canonicalTransformString,fj as chainHasTargetedEffects,hd as claimElementThroughVocabulary,IT as classifyIngestDiagnostic,bo as classifySvgExternalAssetUrl,dh as clipMaskDefinitionFromGroup,ui as clipMaskDefinitionsFromGroups,el as clipMaskGroupDefId,Ut as clipMaskGroupDefinitionId,lh as clipMaskGroupIsRawBacked,As as clipMaskGroupWithDefinition,wf as clipMaskOwnedDefIds,jm as cloneTextSpanTree,YT as collaborationResourceKey,Ny as collectDocumentEnvelopeLibraryReferenceIds,zy as collectFontFacesFromPlan,yG as collectFontFamiliesFromPlan,os as collectMarkerReferences,Ku as collectReferencedLibraryDefs,JE as collectReferencedMarkerIds,Cy as collectSvgFragmentLibraryReferenceIds,Zp as collectUnknownDocumentFields,eH as compareImages,gl as compareOrderKeys,$l as composeDecomposedTransformMatrix,zf as compositeOver,fp as computeArrowVertices,rx as computeCatmullRomSegments,hp as computeCloudPath,up as computeCrossVertices,Ip as computeDashArray,xp as computeFlowchartBoxPath,bp as computeGearPath,tx as computeGearVertices,gp as computeHeartPath,mp as computeLightningVertices,jl as computePolygonVertices,vp as computeRectanglePath,yp as computeRingPath,pp as computeSpeechBubbleVertices,Sp as computeSpiralPath,pr as computeSplinePath,dp as computeStarVertices,ay as connectorLabelAnchor,An as containerTransformNeedsContentPivot,fY as convertGradientUnits,pc as createDocument,Js as createSceneNode,L_ as createShape,Z6 as createSvgDestinationIdAllocator,Qh as createSvgPathMetrics,pq as createTextLayoutKey,mq as createTextLayoutProduct,ks as createViewbox,K2 as createWordSearchPrimitiveMask,Nv as cssAnimationFillField,xa as cssNamedColorToRgb,Tp as cubicBezierExtent1D,qf as cubicBezierToEasingFields,Ic as customPatternDefToLibraryDef,Lm as declaredRichTextDeltaKeys,wa as decodeCssEscapes,im as decodeSvgSourceBytes,Dl as decomposeAffine2D,_y as decoratePlanNodes,By as decorateSnapshotShapes,bk as dedupeFontFaces,aH as defaultVariableMode,Nb as deltaE2000,Y$ as deriveRichTextFormatRanges,uo as deriveSegments,G$ as deriveTextSplice,z0 as derivedConnectionPoints,QC as detachAppearanceStyle,M1 as documentObjectBounds,dx as ellipticalArcBounds,uS as emptyDocumentMetadata,nM as ensureTextSpanRange,ye as escXml,oA as evaluateEasing,W9 as evaluateFontCoverage,iv as evaluateKeyframeEasing,iA as evaluateLinearEasing,rv as evaluateParsedTimingFunction,rA as evaluateSteps,sD as evaluateSvgConditionalProcessing,hS as expandAppearanceStack,Fh as extractVariables,DL as filterAttr,Lw as filterChainExtendsBounds,kT as filterChainGroupId,Va as filterChainGroups,wg as filterDefinitionEnvelope,Kd as filterReferenceValue,Ly as finalizeRenderPlan,pf as findShapeById,jo as fingerprintCssAnimationDocumentStyles,Go as fingerprintCssAnimationInlineStyles,Uo as fingerprintCssAnimationTrack,id as fingerprintIngestSource,Ph as flattenShapeStateTree,ko as flattenStateExtra,_a as flattenUnknownDocumentFields,_v as foldSchemaV2AncestorTransformIntoMatrix,f_ as fontFaceKey,_o as forEachAppearanceLayerRef,Yf as forEachAppearanceStyleRef,QE as forEachLibraryRefInState,ZE as forEachMarkerRefInState,ld as forEachReachableShape,Qp as forEachShapeInLibraryDefs,GY as formatCssFontFamilyList,Rj as formatOperationValidationIssues,hy as formatSmilKeySpline,sn as formatSmilKeyTime,od as freezeIngestPlan,ff as freezeSiblingOrderKeys,jS as generateCode,WR as generateCodeWithDiagnostics,GS as generateCssCode,VS as generateD3Code,me as generateId,bg as generatePatternSvgContent,I2 as generatePuzzlePieces,_S as generateReactCode,E2 as generateSudokuPuzzle,LS as generateSvgCode,BS as generateVueCode,j2 as generateWordSearch,wR as geometryDefinitionId,kR as geometryState,iV as getBuiltInMarkerDefs,nH as getEasingCubicBezier,Lh as getEffectivePrecision,Xp as getIngestFeatureCapability,ad as getIngestFieldPolicy,uP as getKeyframeCubicBezier,Jw as getLicenseLabel,Qw as getLicenseUrl,Ms as getMarkerDescriptors,Vd as getPatternElements,Jo as getShapeGeometryKernel,Wi as getSmilAccumulate,Ws as getSmilAdditive,Ks as getSmilBeginValue,mi as getSmilFillMode,vy as getSmilMotionKeyPoints,by as getSmilRepeatCount,Sy as getSmilSetBeginValue,Hr as getSmilTrackDuration,Bh as getSvgCoordinateAttributePrecision,oi as getSvgPropertySemantics,E as getSvgSourceAttribute,at as getSvgSourceHref,pC as getWordSearchDirections,uY as gradientStopPoint,xs as gradientTransformAttribute,Cg as hasAnyTypedMetadataField,Ki as hasEmittableSmilSimpleDuration,ja as hasOpaqueSvgAncestor,xn as hasSvgSourceAttribute,Xy as importSvg,bT as importSvgWithDiagnostics,Vi as indexLibraryDefinitions,Vy as inferSvgCoordinatePrecision,Uf as initialOrderKeys,MS as injectClipMaskReference,Qv as inspectCssTransformValue,fv as interpolateAngle,dA as interpolateCharOffsetArray,mv as interpolateColor,DH as interpolateDasharrayLists,uA as interpolateGradient,Qf as interpolateNumericArray,EH as interpolatePathData,fA as interpolatePlainObject,cA as interpolatePointArray,OH as interpolatePolylinePoints,vA as interpolateShapeTrees,lA as interpolateSplinePointArray,Ta as invertAffine,AH as isColorValue,ry as isConnectorLineState,Il as isCssAnimationDeclarationName,dc as isCssGenericFamilyName,Zf as isCssNamedColor,yy as isDefaultKeyPoints,Lu as isDefaultKeyTimes,Fa as isDocumentImportIntent,Sk as isEntirelyUnembeddableFamilyList,xi as isFiniteAffineArray,iH as isGeometryTrackProperty,cv as isGradientLike,un as isIdentityAffine,Fu as isIdentityLinearSplines,_u as isIndefiniteSetTrack,Hs as isIndefiniteSmilSimpleDuration,vi as isNumericArray,rH as isPathDataTrackProperty,$u as isPathNodeTrack,xh as isReusablePatternTile,Mi as isSafeGradientRootAttributeName,zi as isSafePatternRootAttributeName,Bu as isSetSequenceTrack,si as isSvgPresentationProperty,HI as isTextPathGeneratedId,jg as isUnembeddableFamilyName,ml as isValidOrderKey,Sa as keyBetween,jf as keysBetween,YC as layerFilterTargets,Qb as layerPaints,PR as layerState,uV as layoutText,cd as legacyEndpointMarkerId,Ye as lerpNumber,g2 as linearGradient,xg as linearGradientEnvelope,gC as lintWordSearchOptions,my as lowerPathNodeTracks,Ab as luma709,_H as mapAnimationTrackTime,JC as matchCubicBezierToPreset,Uj as materializeSceneTreeOrderKeys,sp as matrixTransformPart,Dj as maxCollaborationTimestamp,us as mergeRichTextStyle,Tc as migrateSnapshot,p0 as migrateV11toV12,m0 as migrateV14toV15,g0 as migrateV15toV16,h0 as migrateV16toV17,y0 as migrateV17toV18,S0 as migrateV18toV19,f0 as migrateV6toV7,Pc as migrateViewboxSidecarToViews,kf as motionPathD,Wc as moveResourceById,Ie as multiplyAffine,x_ as mutateSvgClipMaskDefinitionMarkup,Qx as namespaceVocabularies,Ka as namespaceVocabulary,Sl as needsAppearanceStack,Te as nodeSchemas,rr as normalizeClipMaskGroups,Su as normalizePaintServerDef,ps as normalizeRichTextRuns,Sr as normalizeRichTextStyle,kd as normalizeRichTextStyleDelta,lE as normalizeSmilPointsValue,Jj as normalizeSnapshotStructure,rU as normalizeSnapshotToCanonicalDocument,on as orderSiblings,Wf as paintingLayers,ni as parseColor,ip as parseCssAnimationShorthand,Bo as parseCssTimingFunction,Ll as parseCssTransformOrigin,Dh as parseDocument,w0 as parseDocumentWithDiagnostics,nu as parseFontFamilyList,NH as parseInterpolationNumbers,aP as parsePathNodeProperty,Ua as parsePreserveAspectRatio,Mp as parseSmilAdditive,dr as parseSmilClockValue,zp as parseSmilDuration,vx as parseSmilFillField,ao as parseSmilKeySplines,so as parseSmilKeyTimes,bx as parseSmilRepeatSettings,es as parseSmilValues,Yn as parseSvgAbsoluteLength,ze as parseSvgLength,Ho as parseSvgLengthList,Rt as parseSvgLengthToken,Fr as parseSvgPathData,om as parseSvgRootFrame,Cn as parseSvgSourceDocument,S$ as parseSvgStyleAttribute,Rn as parseSvgTransformList,Mt as parseSvgViewBox,xF as parseSvgatorPayload,KB as parseVariableArgs,z2 as parseWordSearchWords,kh as partitionShapeStateTree,gu as partitionStateExtra,Ba as partitionUnknownDocumentFields,aA as pathCommandStructuresMatch,mr as pathDataBounds,cP as pathNodeTracksAreSuperseded,y2 as pattern,vg as patternDefinitionEnvelope,wh as patternLibraryDefToCustomPatternDef,Ih as patternTileSize,Pl as pickCssAnimationListItem,oU as plainTextOf,hR as plainTextStyle,$S as planClipMaskGroups,D_ as planSnapshotExternalEffects,$m as planSvgAnimations,km as planSvgAuthoredAttributes,og as planSvgClipMasks,gm as planSvgConditionalProcessing,dm as planSvgContainerHierarchy,Gg as planSvgDocumentExtensions,cm as planSvgEmbeddedFrames,th as planSvgExternalEffects,pg as planSvgFilters,cg as planSvgGradients,du as planSvgImport,Qm as planSvgLeafGeometry,sg as planSvgMarkers,_g as planSvgMetadata,qa as planSvgOccurrenceViewports,fg as planSvgPaintServerDefinitions,lg as planSvgPatterns,wm as planSvgResourceDependencies,yg as planSvgScripts,ym as planSvgSourceIdentifiers,Om as planSvgStyleCascade,vm as planSvgSymbolUses,bm as planSvgUseOccurrences,am as planSvgViews,xy as planTransformFusion,ES as planVariantTransitions,CS as planVariantTransitionsCss,RS as planVariantTransitionsSmil,AS as planVariantTransitionsWaapi,wy as planViewBoxFusion,Y9 as preferredSubsetsForText,Mf as premultiply,iu as prepareSvgAuthorCssForLiveProjection,Ik as prepareSvgExternalAssetUrlForLiveProjection,S_ as prepareSvgMarkupForLiveProjection,Bx as prepareSvgXmlSource,Hx as preserveAspectRatioAlignFactor,HU as projectClipMaskDefinitionAnimations,Vl as projectCssTransformStops,vf as projectDefinitionAnimations,ac as projectPresentation,Li as projectPresentationEntry,df as projectSceneTreeOntoClipMaskGroups,ra as projectSceneTreeOntoShapes,Ma as projectSvgAnimationPlan,Gp as projectSvgAnimationTimeline,ST as projectSvgImportToIngestPlan,Wy as projectSvgImportToSnapshot,lc as projectSvgSourceNodes,TF as projectSvgatorAnimation,Fs as projectTextLinePosition,Um as projectTextSpanRotations,tk as promoteManagedDescription,$j as promoteRebasedShapeUpdateClock,xf as pruneAndWrapSubtree,Rp as quadraticBezierExtent1D,h2 as radialGradient,Ig as radialGradientEnvelope,X$ as rebaseRichTextFormatRanges,Z$ as rebaseRichTextRuns,gg as recognizeScriptAnimation,zu as reflectCubicBezier,mW as registerNamespaceVocabulary,Jx as registeredExtensionUris,oE as registeredShapeGeometryTypes,yn as removeResourceById,Jy as removeResourceByKey,tS as removeResourceByName,oR as removeTrackKeyframe,Kr as renderAnimationElements,fy as renderBuiltinMarkerDefs,j0 as renderCircle,LR as renderClipMaskDefinitionAnimationElements,_R as renderClipMaskDefinitionShape,Ry as renderDefinitionAnimationElements,Dg as renderDescriptiveElements,Ty as renderDocumentAnimationElements,Ac as renderDocumentExtensionAttributes,ku as renderDocumentExtensionNodes,Pu as renderDocumentExtensions,vS as renderDocumentScripts,sa as renderDocumentStyles,U0 as renderEllipse,OL as renderFilterDefs,Hd as renderFilterElement,OP as renderFilterLibraryDef,kg as renderFilterPrimitive,Uw as renderFilterPrimitivesForType,nP as renderFlowchartBox,Z0 as renderForeignObject,LV as renderGradientDefs,Py as renderGradientStopAnimationElement,q0 as renderImage,Xs as renderLibraryDef,DP as renderLibraryDefs,K0 as renderLine,ly as renderLinearGradient,AP as renderLinearGradientLibraryDef,CP as renderMarkerLibraryDef,qU as renderPaintServerDefs,EP as renderPatternLibraryDef,Kn as renderPlanDefsBody,rP as renderPolygonShape,Y0 as renderPolyline,dy as renderRadialGradient,NP as renderRadialGradientLibraryDef,H0 as renderRectangle,sG as renderReferencedLibraryDefs,Bc as renderResolvedSymbolDefinitionForest,Ey as renderResolvedSymbolDefinitionSubtree,Ys as renderResolvedSymbolLibraryDef,kn as renderShape,gi as renderShapeContextForLibrary,X0 as renderSpline,jw as renderSvgPrimitiveChainFilter,tP as renderSymbolInstance,kP as renderSymbolLibraryDef,IS as renderTemplateVariablesStyle,W0 as renderText,Lc as renderTextSpanAnimationElements,nl as renderToSvg,Pf as renderToSvgWithDiagnostics,DS as renderVariantTransitionScript,OS as renderVariantTransitionStylesheet,uh as replaceClipMaskDefinition,jr as replaceClipMaskGroupsInSceneTree,Kj as replaySceneTreePlacements,Vh as requiredDecimalPrecision,aU as requiredSubsetsForText,Zb as resolveAppearanceStyle,sy as resolveConnectorAnchorFromDocument,iy as resolveConnectorEndpoints,gc as resolveContainerTransform,fu as resolveContainerTransformFromContentBounds,Rv as resolveCssAnimationEasingType,wo as resolveEmbeddedSvgTransform,E1 as resolveEmbeddedSvgViewportFrameBounds,Hg as resolveFontStyle,Ug as resolveFontWeight,NF as resolveGradientGeometry,CF as resolveGradientLibraryDef,vh as resolveInlineContainerTransform,Ng as resolveMetadataQName,sm as resolvePasteWrapperViewportSize,dP as resolvePathDAtTime,$w as resolvePatternLibraryDef,L1 as resolvePatternTile,K$ as resolveRichTextStyleAt,QK as resolveRootViewportFraming,Jn as resolveShapeGeometry,xc as resolveShapeLocalObjectBounds,fi as resolveShapeObjectBounds,Sh as resolveShapeReferenceTransform,iU as resolveStyledTextLines,zd as resolveSvgGradientGeometry,Mr as resolveSvgLengthToken,Sw as resolveSvgPatternTile,rm as resolveSvgQName,hx as resolveSvgRectRadii,Od as resolveSvgTextSpanTarget,ss as resolveSvgViewport,Uu as resolveSymbolDefinitionForestRootIds,Zo as resolveSymbolInstanceContent,WN as resolveSymbolInstanceShapes,bh as resolveSymbolInstanceTransform,yc as resolveSymbolViewport,Wh as resolveTextSpanProjection,LB as rewriteDocumentEmbeddedPayloads,Yu as rewriteIdReferencesInMarkup,Eh as rewriteShapeStateEmbeddedPayloads,qD as rewriteSvgResourceReferenceValue,Kh as richTextFontVariantCss,GI as richTextLineSpans,Oi as richTextRunsFromState,zm as richTextStyleDelta,Bm as richTextStyleDeltasEqual,er as richTextStylesEqual,Nc as richTextTspanAttributes,Og as rootMetadataAttrs,yu as rootPaintServerDefId,Pa as rotateAffine,Gn as roundCoord,VP as roundMarkupCoordinates,xu as roundNumberString,P0 as roundSerializedShape,eV as roundSnapshot,oy as routeConnector,Ei as runsFromSegments,Eb as sameSize,wA as sampleAnimationTrackTime,X9 as sampleTextForSubsets,Gm as sanitizeRichTextFormatRanges,rn as sanitizeXmlId,Wo as scaleAffine,$r as scanCssFunctionTokens,ii as scanCssLocalUrlTokens,Bj as senderCorrectionsForOp,Pp as serializeSvgPathData,gy as serializedPathNodeGeometry,Gr as serializedPresentationReader,Ob as severity,pU as shapeAppearanceLayers,yl as shapeAppearanceStyle,Zl as shapeLocalObjectBounds,$p as shapeLocalObjectCenter,gf as shapeNeedsAppearanceExpansion,k1 as shapeObjectBoundsInSpace,sE as shapeOutlineCapability,Cc as shouldRoundSvgCoordinateAttribute,Nl as skewXAffine,El as skewYAffine,Vu as smilKeyframeAttributes,Ur as snapshotBoundsView,sj as sniffDocumentBytes,va as solveCubicBezier,Of as solveSudoku,rM as spliceTextSpanTree,UN as splinePathBounds,qC as splitAppearanceForStyle,kl as splitCssAnimationList,Dr as splitCssTopLevel,ri as splitCssTopLevelRanges,Gc as splitTopLevelElements,$f as srgbToLab,Ff as ssimPlane,Oh as stringifyDocument,Qc as stripAnimationDeclarations,wl as stripCssAnimationInlineStyle,SR as subsetsForCodePoint,$h as substituteString,vu as substituteVariables,My as symbolDefinitionSemanticHash,Na as symbolInstanceTargetId,Av as synthesizeCssAnimationShorthand,Sf as templateVariablesCss,Cd as textPathGeneratedId,Rd as textSpanEffectiveRotations,Td as textSpanIds,UI as textSpanNodeById,tM as textSpanRangeByIds,wd as transformSplice,FN as transformSvgPathData,ft as translateAffine,zN as translateSvgPathData,vn as tryParseSvgTransformList,qu as unmatchedDecorationDiagnostics,sY as updateGradientLibraryDef,cn as upsertResourceById,Qy as upsertResourceByKey,eS as upsertResourceByName,iR as upsertTrackKeyframe,Pj as validateDocumentOperations,Zy as validateOperation,Tj as validatePresenceOperation,vo as validateSnapshot,N2 as validateSudokuPuzzle,zr as verticesToPath,In as visitShapeTree,ht as visitSnapshotShapeTrees,ba as writeAppearanceLayers};
|
|
98
|
+
`)}function jS(e,t){return WR(e,t).code}function WR(e,t){let n=new $s;return{code:Iu(n,()=>f2(e,t)),diagnostics:n.diagnostics}}function f2(e,t){let n=m2(e,t),r={...t};return Fy(p2(n,r))}function p2(e,t){switch(t.format){case"svg":return LS(e,t);case"react":return _S(e,t);case"vue":return BS(e,t);case"d3":return VS(e,t);case"css":return GS(e,t);default:throw new Error(`Unsupported code format: ${t.format}`)}}function m2(e,t){if(Array.isArray(e)){let n=$P(e);return{shapes:e,viewboxes:[{id:"default",x:0,y:0,width:t.width??800,height:t.height??600}],...n.length>0?{library:n}:{}}}return e}var US=class e{_snapshot;constructor(t={}){let{width:n=800,height:r=600,viewboxId:i}=t,o=ks(0,0,n,r,i);this._snapshot=pc({viewboxes:[o]})}static fromSnapshot(t){let n=new e;return n._snapshot=JSON.parse(JSON.stringify(t)),n}static fromJSON(t,n){let r=Dh(t,n),i=new e;return i._snapshot=r,i}static fromSVG(t,n){return e.fromSnapshot(Xy(t,n))}add(t){let n="build"in t&&typeof t.build=="function"?t.build():t;return this._snapshot.shapes.push(n),this}addAll(...t){for(let n of t)this.add(n);return this}remove(t){let n=this._snapshot.shapes.length;return this._snapshot.shapes=this._snapshot.shapes.filter(r=>r.id!==t),this._snapshot.shapes.length<n}get shapes(){return this._snapshot.shapes}findShape(t){return this._snapshot.shapes.find(n=>n.id===t)}size(t,n){return this._snapshot.viewboxes.length>0?(this._snapshot.viewboxes[0].width=t,this._snapshot.viewboxes[0].height=n):this._snapshot.viewboxes=[ks(0,0,t,n)],this}get width(){return this._snapshot.viewboxes[0]?.width??800}get height(){return this._snapshot.viewboxes[0]?.height??600}title(t){return this._ensureMetadata(),this._snapshot.documentMetadata.title=t,this}description(t){return this._ensureMetadata(),this._snapshot.documentMetadata.description=t,this}author(t){return this._ensureMetadata(),this._snapshot.documentMetadata.author=t,this}keywords(...t){return this._ensureMetadata(),this._snapshot.documentMetadata.keywords=t,this}license(t,n){return this._ensureMetadata(),this._snapshot.documentMetadata.license=t,n!==void 0&&(this._snapshot.documentMetadata.licenseUrl=n),this}language(t){return this._ensureMetadata(),this._snapshot.documentMetadata.language=t,this}customMetadata(t){return this._ensureMetadata(),this._snapshot.documentMetadata.customMetadata={...this._snapshot.documentMetadata.customMetadata,...t},this}get meta(){return this._snapshot.documentMetadata}defineSymbol(t,n,r){let i=me(),o=n.map(l=>"build"in l&&typeof l.build=="function"?l.build():l),s={kind:"symbol",id:i,name:t,shapes:o};r?.thumbnail&&(s.thumbnail=r.thumbnail),r?.defKind&&(s.defKind=r.defKind),r?.definitionPlacement&&(s.definitionPlacement=r.definitionPlacement);let a={...r?.rootAttributes??{}},c=a.viewBox;delete a.viewBox,r?.viewBox!==null&&(s.viewBox=r?.viewBox??c??"0 0 100 100");for(let l of["preserveAspectRatio","x","y","width","height","refX","refY"])r?.[l]!==void 0?s[l]=r[l]:s[l]===void 0&&a[l]!==void 0&&(s[l]=a[l]),delete a[l];return Object.keys(a).length>0&&(s.rootAttributes=a),r?.variantAxes&&(s.variantAxes=r.variantAxes),r?.variants&&(s.variants=Object.fromEntries(Object.entries(r.variants).map(([l,d])=>[l,d]))),r?.variantThumbnails&&(s.variantThumbnails=r.variantThumbnails),this._pushLibraryDef(s),i}placeSymbolInstance(t,n,r,i={}){let o=i.width,s=i.height,a={symbolId:t,x:n,y:r,width:o??100,height:s??100},c=i.authoredUseGeometry??{x:String(n),y:String(r),...o!==void 0?{width:String(o)}:{},...s!==void 0?{height:String(s)}:{}};Object.keys(c).length>0&&(a.authoredUseGeometry=c),i.variantKey&&(a.variantKey=i.variantKey),i.symbolOverrides&&(a.symbolOverrides=i.symbolOverrides),i.instancePresentation&&(a.instancePresentation=i.instancePresentation);let l={id:me(),type:"symbol-instance",state:a};return this._snapshot.shapes.push(l),this}removeSymbol(t){if(!this._snapshot.library)return!1;let n=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(r=>!(r.kind==="symbol"&&r.id===t)),this._snapshot.library.length<n}get symbols(){return(this._snapshot.library??[]).filter(t=>t.kind==="symbol")}defineMarker(t,n,r){let i=me(),o=n.map(a=>"build"in a&&typeof a.build=="function"?a.build():a),s={kind:"marker",id:i,name:t,viewBox:r?.viewBox??"0 0 10 10",refX:r?.refX??5,refY:r?.refY??5,markerWidth:r?.markerWidth??10,markerHeight:r?.markerHeight??10,markerUnits:r?.markerUnits??"strokeWidth",orient:r?.orient??"auto",shapes:o};return r?.preserveAspectRatio!==void 0&&(s.preserveAspectRatio=r.preserveAspectRatio),r?.authoredGeometry&&(s.authoredGeometry={...r.authoredGeometry}),r?.rootAttributes&&(s.rootAttributes={...r.rootAttributes}),r?.thumbnail&&(s.thumbnail=r.thumbnail),this._pushLibraryDef(s),i}defineFilter(t,n,r){let i=me(),o={kind:"filter",id:i,name:t,filters:n};return r?.colorInterpolation&&(o.colorInterpolation=r.colorInterpolation),r?.filterUnits&&(o.filterUnits=r.filterUnits),r?.primitiveUnits&&(o.primitiveUnits=r.primitiveUnits),r?.x!==void 0&&(o.x=r.x),r?.y!==void 0&&(o.y=r.y),r?.width!==void 0&&(o.width=r.width),r?.height!==void 0&&(o.height=r.height),r?.thumbnail&&(o.thumbnail=r.thumbnail),this._pushLibraryDef(o),i}defineLinearGradientLibrary(t,n,r){let i=me(),o="build"in n?n.build():n,{id:s,sourceId:a,...c}=o,l={kind:"linear-gradient",id:i,name:t,gradient:c};return r?.thumbnail&&(l.thumbnail=r.thumbnail),this._pushLibraryDef(l),i}defineRadialGradientLibrary(t,n,r){let i=me(),o="build"in n?n.build():n,{id:s,sourceId:a,...c}=o,l={kind:"radial-gradient",id:i,name:t,gradient:c};return r?.thumbnail&&(l.thumbnail=r.thumbnail),this._pushLibraryDef(l),i}definePatternLibrary(t,n,r){let i=me(),o="build"in n?n.build():n,{id:s,sourceId:a,customPatternId:c,...l}=o,d={kind:"pattern",id:i,name:t,pattern:l};return r?.thumbnail&&(d.thumbnail=r.thumbnail),this._pushLibraryDef(d),i}removeLibraryDef(t){if(!this._snapshot.library)return!1;let n=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(r=>r.id!==t),this._snapshot.library.length<n}get library(){return this._snapshot.library??[]}_pushLibraryDef(t){this._snapshot.library||(this._snapshot.library=[]);let n=this._snapshot.library.findIndex(r=>r.id===t.id);n>=0?this._snapshot.library[n]=t:this._snapshot.library.push(t)}addClipGroup(t,n,r){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=me(),o={id:i,type:"clip",clipShapeIds:t,contentShapeIds:n,parentId:null};return r?.clipPathUnits&&(o.clipPathUnits=r.clipPathUnits),r?.definitionPlacement&&(o.definitionPlacement=r.definitionPlacement),r?.clipRule&&(o.clipRule=r.clipRule),r?.rawDefinition&&(o.rawDefinition=r.rawDefinition),this._snapshot.clipMaskGroups.push(o),i}addMaskGroup(t,n,r){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=me(),o={id:i,type:"mask",clipShapeIds:t,contentShapeIds:n,parentId:null};return r?.maskUnits&&(o.maskUnits=r.maskUnits),r?.maskContentUnits&&(o.maskContentUnits=r.maskContentUnits),r?.maskBounds&&(o.maskBounds=r.maskBounds),r?.maskType&&(o.maskType=r.maskType),r?.definitionPlacement&&(o.definitionPlacement=r.definitionPlacement),r?.rawDefinition&&(o.rawDefinition=r.rawDefinition),this._snapshot.clipMaskGroups.push(o),i}removeClipMaskGroup(t){if(!this._snapshot.clipMaskGroups)return!1;let n=this._snapshot.clipMaskGroups.length;return this._snapshot.clipMaskGroups=this._snapshot.clipMaskGroups.filter(r=>r.id!==t),this._snapshot.clipMaskGroups.length<n}addGuide(t,n,r){this._snapshot.guides||(this._snapshot.guides=[]);let i=me(),o={id:i,orientation:t,position:n,controlPointOffset:0};return r?.color&&(o.color=r.color),r?.opacity!==void 0&&(o.opacity=r.opacity),this._snapshot.guides.push(o),i}removeGuide(t){if(!this._snapshot.guides)return!1;let n=this._snapshot.guides.length;return this._snapshot.guides=this._snapshot.guides.filter(r=>r.id!==t),this._snapshot.guides.length<n}clearGuides(){return this._snapshot.guides=[],this}get guides(){return this._snapshot.guides??[]}addMeasurement(t,n,r){this._snapshot.measurements||(this._snapshot.measurements=[]);let i=me(),o={id:i,type:t,points:n,visible:r?.visible??!0,snapDivisions:r?.snapDivisions??1};return r?.color&&(o.color=r.color),r?.opacity!==void 0&&(o.opacity=r.opacity),this._snapshot.measurements.push(o),i}removeMeasurement(t){if(!this._snapshot.measurements)return!1;let n=this._snapshot.measurements.length;return this._snapshot.measurements=this._snapshot.measurements.filter(r=>r.id!==t),this._snapshot.measurements.length<n}get measurements(){return this._snapshot.measurements??[]}addCustomPattern(t,n,r,i){let o=me();return this._pushLibraryDef(Ic({id:o,name:t,svgContent:n,width:r,height:i})),o}removeCustomPattern(t){let n=this._snapshot.library;if(!n)return!1;let r=n.length;return this._snapshot.library=n.filter(i=>!(i.kind==="pattern"&&i.id===t)),this._snapshot.library.length<r}get customPatterns(){let t=[];for(let n of this._snapshot.library??[]){if(n.kind!=="pattern")continue;let r=wh(n);r&&t.push(r)}return t}bringToFront(t){let n=this._snapshot.shapes.findIndex(r=>r.id===t);if(n>=0){let[r]=this._snapshot.shapes.splice(n,1);this._snapshot.shapes.push(r)}return this}sendToBack(t){let n=this._snapshot.shapes.findIndex(r=>r.id===t);if(n>=0){let[r]=this._snapshot.shapes.splice(n,1);this._snapshot.shapes.unshift(r)}return this}reorder(t,n){let r=this._snapshot.shapes.findIndex(i=>i.id===t);if(r>=0){let[i]=this._snapshot.shapes.splice(r,1),o=Math.max(0,Math.min(n,this._snapshot.shapes.length));this._snapshot.shapes.splice(o,0,i)}return this}defineVariable(t,n,r,i){this._snapshot.templateVariables||(this._snapshot.templateVariables=[]);let o=this._snapshot.templateVariables.find(s=>s.name===t);if(o)o.type=n,o.defaultValue=r,i?.label!==void 0&&(o.label=i.label),i?.description!==void 0&&(o.description=i.description);else{let s={name:t,type:n,defaultValue:r};i?.label!==void 0&&(s.label=i.label),i?.description!==void 0&&(s.description=i.description),this._snapshot.templateVariables.push(s)}return this}removeVariable(t){return this._snapshot.templateVariables&&(this._snapshot.templateVariables=this._snapshot.templateVariables.filter(n=>n.name!==t)),this}get variables(){return this._snapshot.templateVariables??[]}inspectVariables(){return Fh(this._snapshot)}setTimeline(t){return"build"in t&&typeof t.build=="function"?this._snapshot.animationTimeline=t.build():this._snapshot.animationTimeline=t,this}clearTimeline(){return delete this._snapshot.animationTimeline,this}get timeline(){return this._snapshot.animationTimeline}toSVG(t){let{variables:n,...r}=t??{},i=vu(this._snapshot,n);return nl(i,r)}toSVGWithDiagnostics(t){let{variables:n,...r}=t??{},i=vu(this._snapshot,n);return Pf(i,r)}toJSON(t){return Oh(this._snapshot,t)}toSnapshot(){return JSON.parse(JSON.stringify(this._snapshot))}toCode(t,n){return jS(this._snapshot,{...n,format:t})}_ensureMetadata(){this._snapshot.documentMetadata||(this._snapshot.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{}})}};var HS=class{_track;constructor(t,n){this._track={id:me(),shapeId:t,property:n,keyframes:[],enabled:!0,locked:!1}}id(t){return this._track.id=t,this}keyframe(t,n,r="linear"){return this._track.keyframes.push({id:me(),time:t,value:n,easing:r}),this}keyframeBezier(t,n,r){return this._track.keyframes.push({id:me(),time:t,value:n,easing:"custom-bezier",customBezier:r}),this}keyframeLinear(t,n,r){return this._track.keyframes.push({id:me(),time:t,value:n,easing:"linear-function",linearPoints:r}),this}keyframes(...t){return this._track.keyframes.push(...t.map(n=>({...n,id:n.id??me()}))),this}disabled(){return this._track.enabled=!1,this}locked(){return this._track.locked=!0,this}motionPath(t){return this._track.motionPath=t,this}motionPathRef(t,n="trackShape"){return this._track.motionPathRef={shapeId:t,mode:n},this}beginTrigger(t,n){return this._track.beginTrigger={type:t,value:n},this}endTrigger(t,n){return this._track.endTrigger={type:t,value:n},this}cycleDuration(t){return this._track.cycleDuration=t,this}cycleRepeats(t){return this._track.cycleRepeats=t,this}infinite(){return this._track.cycleInfinite=!0,this}cycle(t){return this._track.cycleBehavior=t,this}transformOrigin(t,n){return this._track.transformOrigin={x:t,y:n},this._track.targetTransformOrigin=void 0,this}motionRotate(t){return this._track.motionRotate=t,this}additive(t){return this._track.additive=t,this}accumulate(t="sum"){return this._track.accumulate=t,this}fill(t){return this._track.fill=t,this}fillBackwards(t=!0){return this._track.fillBackwards=t,this}build(){let t=[...this._track.keyframes].sort((n,r)=>n.time-r.time);return{...this._track,keyframes:t}}},KS=class{_duration;_loop=!1;_playbackSpeed=1;_tracks=[];constructor(t){this._duration=t}loop(t=!0){return this._loop=t,this}speed(t){return this._playbackSpeed=t,this}duration(t){return this._duration=t,this}addTrack(t){return this._tracks.push(t),this}addTracks(...t){return this._tracks.push(...t),this}buildTimeline(){return{duration:this._duration,loop:this._loop,playbackSpeed:this._playbackSpeed,tracks:this._tracks.map(t=>t.build())}}build(){let t=this.buildTimeline();return{duration:t.duration,loop:t.loop,playbackSpeed:t.playbackSpeed,tracks:t.tracks.map(n=>({id:n.id,shapeId:n.shapeId,property:n.property,enabled:n.enabled,locked:n.locked||void 0,motionPath:n.motionPath,motionPathRef:n.motionPathRef,beginTrigger:n.beginTrigger,endTrigger:n.endTrigger,cycleDuration:n.cycleDuration,simpleDuration:n.simpleDuration,cycleRepeats:n.cycleRepeats,cycleInfinite:n.cycleInfinite,cycleBehavior:n.cycleBehavior,fillBackwards:n.fillBackwards,transformOrigin:n.transformOrigin,targetTransformOrigin:n.targetTransformOrigin,motionRotate:n.motionRotate,additive:n.additive,accumulate:n.accumulate,fill:n.fill,keyframes:n.keyframes.map(r=>({id:r.id,time:r.time,value:r.value,easing:r.easing,...r.customBezier?{customBezier:r.customBezier}:{},...r.linearPoints?{linearPoints:r.linearPoints}:{}}))}))}}};var ln=class{_id;_type;_state={};constructor(t,n){this._type=t,this._id=n??me()}id(t){return this._id=t,this}locked(t=!0){return this._state.locked=t,this}visible(t=!0){return this._state.visible=t,this}displayMode(t){return this._state.displayMode=t,this}motionOnly(){return this._state.displayMode="motionOnly",this}fill(t,n){return this._state.fillColor=t,this._state.fillType="solid",n!==void 0&&(this._state.fillOpacity=n),this}noFill(){return this._state.fillType="none",this}fillGradient(t){let n="build"in t?t.build():t;return this._state.fillType=n.type,this._state.fillGradient=n,this}fillPattern(t){let n="build"in t?t.build():t;return this._state.fillType="pattern",this._state.fillGradient=n,this}fillOpacity(t){return this._state.fillOpacity=t,this}fillRule(t){return this._state.fillRule=t,this}addFill(t,n){let r={id:`fill-${this.nextLayerOrdinal("fill")}`,kind:"fill",color:t,paintType:"solid"};return n!==void 0&&(r.opacity=n),this.pushAppearanceLayer(r),this}addStroke(t,n){let r={id:`stroke-${this.nextLayerOrdinal("stroke")}`,kind:"stroke",color:t,paintType:"solid"};return n!==void 0&&(r.width=n),this.pushAppearanceLayer(r),this}pushAppearanceLayer(t){let n=Xf(this._state,t);Object.assign(this._state,n)}nextLayerOrdinal(t){let r=(this._state.appearance??[]).filter(i=>i.kind===t).length;return Math.max(r,1)}stroke(t,n){return this._state.borderColor=t,n!==void 0&&(this._state.borderWidth=n),this}noStroke(){return this._state.borderColor="none",this._state.borderWidth=0,this}strokeWidth(t){return this._state.borderWidth=t,this}strokeOpacity(t){return this._state.strokeOpacity=t,this}strokeGradient(t){let n="build"in t?t.build():t;return this._state.strokeType=n.type,this._state.strokeGradient=n,this}strokePattern(t){let n="build"in t?t.build():t;return this._state.strokeType="pattern",this._state.strokeGradient=n,this}strokeLinejoin(t){return this._state.strokeLinejoin=t,this}strokeLinecap(t){return this._state.strokeLinecap=t,this}strokeMiterlimit(t){return this._state.strokeMiterlimit=t,this}dashOffset(t){return this._state.dashOffset=t,this}strokeDasharray(t){return this._state.strokeDasharray=t,this}dash(t,n,r){return this._state.lineStyle=t,t==="custom"&&(n!==void 0&&(this._state.dashLength=n),r!==void 0&&(this._state.gapLength=r)),this}opacity(t){return this._state.opacity=t,this}rotate(t){return this._state.rotation=t,this.refreshTransformMatrix(),this}skew(t,n){return this._state.skewX=t,this._state.skewY=n,this.refreshTransformMatrix(),this}scale(t,n){return this._state.scaleX=t,this._state.scaleY=n??t,this.refreshTransformMatrix(),this}pivot(t,n){return this._state.customPivot={x:t,y:n},this.refreshTransformMatrix(),this}transformMatrix(t){if(t.length<6||!t.slice(0,6).every(Number.isFinite))throw new RangeError("transformMatrix must contain six finite numbers");return this._state.transformMatrix=t.slice(0,6),this}refreshTransformMatrix(){this._state.transformMatrix=Ct($l(this._state,this.defaultTransformPivot()))}defaultTransformPivot(){let t=this._state.customPivot;if(t)return t;let n=this._state.x,r=this._state.y,i=this._state.width,o=this._state.height;if(n!==void 0&&r!==void 0&&i!==void 0&&o!==void 0)return{x:n+i/2,y:r+o/2};let s=this._state.radius;if(n!==void 0&&r!==void 0&&s!==void 0)return{x:n,y:r};let a=this._state.cx,c=this._state.cy;if(a!==void 0&&c!==void 0)return{x:a,y:c};let l=this._state.x1,d=this._state.y1,u=this._state.x2,f=this._state.y2;if(l!==void 0&&d!==void 0&&u!==void 0&&f!==void 0)return{x:(l+u)/2,y:(d+f)/2};let p=this._state.pathPoints;if(p?.[0])return{x:p[0].x,y:p[0].y};let m=this._state.polylinePoints;if(m?.[0])return m[0]}filter(...t){let n=this._state.filters??[];return this._state.filters=[...n,...t],this}dropShadow(t={}){let n={id:`drop-shadow-${me()}`,type:"drop-shadow",enabled:!0,offsetX:t.offsetX??4,offsetY:t.offsetY??4,blurRadius:t.blurRadius??8,spread:t.spread??0,color:t.color??"#000000",opacity:t.opacity??.3};return this.filter(n)}innerShadow(t={}){let n={id:`inner-shadow-${me()}`,type:"inner-shadow",enabled:!0,offsetX:t.offsetX??2,offsetY:t.offsetY??2,blurRadius:t.blurRadius??4,choke:t.choke??0,color:t.color??"#000000",opacity:t.opacity??.5};return this.filter(n)}blur(t,n,r){let i=t??4,o=n??i,s={id:`gaussian-blur-${me()}`,type:"gaussian-blur",enabled:!0,blurX:i,blurY:o,linked:i===o,quality:r?.quality??"normal"};return this.filter(s)}glow(t={}){let n={id:`glow-${me()}`,type:"glow",enabled:!0,color:t.color??"#ffffff",radius:t.radius??10,intensity:t.intensity??.8};return this.filter(n)}innerGlow(t={}){let n={id:`inner-glow-${me()}`,type:"inner-glow",enabled:!0,color:t.color??"#ffffff",radius:t.radius??10,intensity:t.intensity??.8};return this.filter(n)}grayscale(t=1){let n={id:`grayscale-${me()}`,type:"grayscale",enabled:!0,amount:t};return this.filter(n)}sepia(t=1){let n={id:`sepia-${me()}`,type:"sepia",enabled:!0,amount:t};return this.filter(n)}outline(t={}){return this.filter({id:`outline-${me()}`,type:"outline",enabled:!0,width:t.width??3,color:t.color??"#000000",opacity:t.opacity??1,position:t.position??"outside"})}motionBlur(t={}){let n={id:`motion-blur-${me()}`,type:"motion-blur",enabled:!0,distance:t.distance??10,angle:t.angle??0,quality:t.quality??"normal"};return this.filter(n)}pointLight(t={}){let n={id:`point-light-${me()}`,type:"point-light",enabled:!0,x:t.x??100,y:t.y??100,z:t.z??200,color:t.color??"#ffffff",surfaceScale:t.surfaceScale??5,diffuseConstant:t.diffuseConstant??1,specularConstant:t.specularConstant??1,specularExponent:t.specularExponent??20};return this.filter(n)}spotLight(t={}){let n={id:`spot-light-${me()}`,type:"spot-light",enabled:!0,x:t.x??100,y:t.y??0,z:t.z??200,pointsAtX:t.pointsAtX??100,pointsAtY:t.pointsAtY??100,pointsAtZ:t.pointsAtZ??0,coneAngle:t.coneAngle??30,color:t.color??"#ffffff",surfaceScale:t.surfaceScale??5,specularConstant:t.specularConstant??1,specularExponent:t.specularExponent??20};return this.filter(n)}sharpen(t=1){let n={id:`sharpen-${me()}`,type:"sharpen",enabled:!0,amount:t};return this.filter(n)}pixelate(t=8){let n={id:`pixelate-${me()}`,type:"pixelate",enabled:!0,blockSize:t};return this.filter(n)}warp(t={}){let n={id:`warp-${me()}`,type:"warp",enabled:!0,scale:t.scale??10,frequency:t.frequency??.02,octaves:t.octaves??1,warpType:t.warpType??"turbulence"};return this.filter(n)}morphology(t={}){let n=t.radiusX??2,r=t.radiusY??n,i={id:`morphology-${me()}`,type:"morphology",enabled:!0,operator:t.operator??"dilate",radiusX:n,radiusY:r,linked:t.linked??n===r};return this.filter(i)}contouring(t={}){if((t.mode??"discrete")==="table"){let i={id:`contouring-table-${me()}`,type:"contouring-table",enabled:!0,levels:t.levels??4,contrast:t.contrast??1};return this.filter(i)}let r={id:`contouring-discrete-${me()}`,type:"contouring-discrete",enabled:!0,levels:t.levels??4};return this.filter(r)}roundEdges(t=4){let n={id:`round-edges-${me()}`,type:"round-edges",enabled:!0,radius:t};return this.filter(n)}channelPainter(t={}){let n={id:`channel-painter-${me()}`,type:"channel-painter",enabled:!0,red:t.red??1,green:t.green??1,blue:t.blue??1};return this.filter(n)}brightness(t=1){let n={id:`brightness-${me()}`,type:"brightness",enabled:!0,amount:t};return this.filter(n)}contrast(t=1){let n={id:`contrast-${me()}`,type:"contrast",enabled:!0,amount:t};return this.filter(n)}filterOpacity(t=1){let n={id:`opacity-${me()}`,type:"opacity",enabled:!0,amount:t};return this.filter(n)}invert(t=1){let n={id:`invert-${me()}`,type:"invert",enabled:!0,amount:t};return this.filter(n)}hueRotate(t=0){let n={id:`hue-rotate-${me()}`,type:"hue-rotate",enabled:!0,angle:t};return this.filter(n)}saturate(t=1){let n={id:`saturate-${me()}`,type:"saturate",enabled:!0,amount:t};return this.filter(n)}blackAndWhite(t=.5){let n={id:`black-and-white-${me()}`,type:"black-and-white",enabled:!0,threshold:t};return this.filter(n)}duotone(t={}){let n={id:`duotone-${me()}`,type:"duotone",enabled:!0,shadowColor:t.shadowColor??"#000000",highlightColor:t.highlightColor??"#ffffff"};return this.filter(n)}xray(t=1){let n={id:`xray-${me()}`,type:"xray",enabled:!0,intensity:t};return this.filter(n)}noise(t={}){let n={id:`noise-${me()}`,type:"noise",enabled:!0,amount:t.amount??.3,scale:t.scale??1};return this.filter(n)}emboss(t={}){let n={id:`emboss-${me()}`,type:"emboss",enabled:!0,strength:t.strength??1,angle:t.angle??135};return this.filter(n)}filmGrain(t={}){let n={id:`film-grain-${me()}`,type:"film-grain",enabled:!0,amount:t.amount??.3,size:t.size??1};return this.filter(n)}watercolor(t={}){let n={id:`watercolor-${me()}`,type:"watercolor",enabled:!0,wetness:t.wetness??.5,turbulence:t.turbulence??.5};return this.filter(n)}gouache(t={}){let n={id:`gouache-${me()}`,type:"gouache",enabled:!0,thickness:t.thickness??.5,texture:t.texture??.5};return this.filter(n)}inkBlot(t={}){let n={id:`ink-blot-${me()}`,type:"ink-blot",enabled:!0,spread:t.spread??.5,edges:t.edges??.5};return this.filter(n)}crumpledPlastic(t={}){let n={id:`crumpled-plastic-${me()}`,type:"crumpled-plastic",enabled:!0,wrinkles:t.wrinkles??.5,shine:t.shine??.5};return this.filter(n)}riddled(t={}){let n={id:`riddled-${me()}`,type:"riddled",enabled:!0,density:t.density??.5,size:t.size??1};return this.filter(n)}cssClipPath(t){return this._state.cssClipPath=t,this}cssMaskProperties(t){return this._state.cssMaskProperties=t,this}vectorEffect(t){return this._state.vectorEffect=t,this}transformBox(t){return this._state.transformBox=t,this}paintOrder(t){return this._state.paintOrder=t,this}blendMode(t){return this._state.blendMode=t,this}visibility(t){return this._state.visibility=t,this}shapeRendering(t){return this._state.shapeRendering=t,this}filterColorInterpolation(t){return this._state.filterColorInterpolation=t,this}inheritFill(t=!0){return this._state.inheritFill=t,this}inheritStroke(t=!0){return this._state.inheritStroke=t,this}systemLanguage(t){return this._state.systemLanguage=t,this}requiredExtensions(t){return this._state.requiredExtensions=t,this}fillLibrary(t,n="linear-gradient"){return this._state.fillLibraryId=t,this._state.fillType=n,this}strokeLibrary(t,n="linear-gradient"){return this._state.strokeLibraryId=t,this._state.strokeType=n,this}filterLibrary(...t){let n=this._state.filterLibraryIds??[];return this._state.filterLibraryIds=[...n,...t],this}markerStartRef(t){return this._state.markerStart=t,this}markerMidRef(t){return this._state.markerMid=t,this}markerEndRef(t){return this._state.markerEnd=t,this}bind(t,n){let r=this._state.bindings??{};return this._state.bindings={...r,[t]:n},this}metadata(t){return this._state.metadata={...this._state.metadata,...t},this}build(){return{id:this._id,type:this._type,state:{...this._state}}}},WS=class extends ln{constructor(t,n,r){if(r<0)throw new RangeError("Circle radius must be non-negative");super("circle"),this._state.x=t,this._state.y=n,this._state.radius=r}position(t,n){return this._state.x=t,this._state.y=n,this}radius(t){return this._state.radius=t,this}},XS=class extends ln{constructor(t,n,r,i){if(r<0||i<0)throw new RangeError("Ellipse radii must be non-negative");super("ellipse"),this._state.cx=t,this._state.cy=n,this._state.rx=r,this._state.ry=i}position(t,n){return this._state.cx=t,this._state.cy=n,this}radii(t,n){return this._state.rx=t,this._state.ry=n,this}},YS=class extends ln{constructor(t,n,r,i){if(r<0||i<0)throw new RangeError("Rectangle dimensions must be non-negative");super("rectangle"),this._state.x=t,this._state.y=n,this._state.width=r,this._state.height=i}position(t,n){return this._state.x=t,this._state.y=n,this}size(t,n){return this._state.width=t,this._state.height=n,this}cornerRadius(t){return this._state.cornerRadius=t,this._state.rx=t,this._state.ry=t,this}radii(t,n){return this._state.rx=t,this._state.ry=n,t===n&&(this._state.cornerRadius=t),this}},qS=class extends ln{constructor(t,n,r){if(r<0)throw new RangeError("Square size must be non-negative");super("square"),this._state.x=t,this._state.y=n,this._state.width=r,this._state.height=r}position(t,n){return this._state.x=t,this._state.y=n,this}size(t){return this._state.width=t,this._state.height=t,this}cornerRadius(t){return this._state.cornerRadius=t,this._state.rx=t,this._state.ry=t,this}radii(t,n){return this._state.rx=t,this._state.ry=n,t===n&&(this._state.cornerRadius=t),this}},ZS=class extends ln{constructor(t,n,r,i){super("line"),this._state.x1=t,this._state.y1=n,this._state.x2=r,this._state.y2=i}from(t,n){return this._state.x1=t,this._state.y1=n,this}to(t,n){return this._state.x2=t,this._state.y2=n,this}markerStart(t){return this._state.startEndpoint=t,this}markerEnd(t){return this._state.endEndpoint=t,this}markers(t,n){return this._state.startEndpoint=t,this._state.endEndpoint=n,this}},QS=class extends ln{constructor(t,n,r){super("text"),this._state.x=t,this._state.y=n,this._state.text=r}position(t,n){return this._state.x=t,this._state.y=n,this}content(t){return this._state.text=t,this}fontSize(t){return this._state.fontSize=t,this}fontFamily(t){return this._state.fontFamily=t,this}fontWeight(t){return this._state.fontWeight=t,this}fontStyle(t){return this._state.fontStyle=t,this}fontVariant(t){return this._state.fontVariant=t,this}fontVariantLigatures(t){return this._state.fontVariantLigatures=t,this}fontVariantPosition(t){return this._state.fontVariantPosition=t,this}fontVariantCaps(t){return this._state.fontVariantCaps=t,this}fontVariantNumeric(t){return this._state.fontVariantNumeric=t,this}fontVariantEastAsian(t){return this._state.fontVariantEastAsian=t,this}anchor(t){return this._state.textAnchor=t,this}letterSpacing(t){return this._state.letterSpacing=t,this}lineHeight(t){return this._state.lineHeight=t,this}decoration(t){return this._state.textDecoration=t,this}transform(t){return this._state.textTransform=t,this}textPath(t,n=0){return this._state.isTextPath=!0,this._state.textPathPoints=t,this._state.textPathStartOffset=n,this}textPathOffset(t){return this._state.textPathStartOffset=t,this}textPathSide(t){return this._state.textPathSide=t,this}direction(t){return this._state.textDirection=t,this}unicodeBidi(t){return this._state.unicodeBidi=t,this}dominantBaseline(t){return this._state.dominantBaseline=t,this}writingMode(t){return this._state.writingMode=t,this}wordSpacing(t){return this._state.wordSpacing=t,this}baselineShift(t){return this._state.baselineShift=t,this}inlineSize(t){return this._state.inlineSize=t,this}overflowWrap(t){return this._state.overflowWrap=t,this}whiteSpace(t){return this._state.whiteSpace=t,this}fontVariationSettings(t){return this._state.fontVariationSettings=t,this}charOffsets(t){return this._state.charOffsets=t,this}shapeInsideRef(t){return this._state.shapeInsideRef=t,this}shapePadding(t){return this._state.shapePadding=t,this}richTextSegments(t){return this._state.richTextRuns=Ei(t),this}richTextRuns(t){let n=ps(t);return this._state.richTextRuns=n,this}useRichText(t=!0){return this._state.useRichText=t,this}linePositions(t){return this._state.linePositions=t,this}textLength(t){return this._state.textLength=t,this}lengthAdjust(t){return this._state.lengthAdjust=t,this}},En=class extends ln{constructor(t,n,r,i){super(t),this._state.cx=n,this._state.cy=r,this._state.radius=i}position(t,n){return this._state.cx=t,this._state.cy=n,this}radius(t){return this._state.radius=t,this}shiftAngle(t){return this._state.shiftAngle=t,this}cornerRadius(t){return this._state.cornerRadius=t,this}},JS=class extends En{constructor(t,n,r){super("triangle",t,n,r)}},eb=class extends En{constructor(t,n,r,i=5){super("ngon",t,n,r),this._state.sides=i}sides(t){return this._state.sides=t,this}},tb=class extends En{constructor(t,n,r){super("star",t,n,r),this._state.arms=5,this._state.innerRadiusPercent=40}arms(t){return this._state.arms=t,this}innerRadius(t){return this._state.innerRadiusPercent=t,this}},nb=class extends En{constructor(t,n,r){super("cross",t,n,r),this._state.armWidthPercent=35}armWidth(t){return this._state.armWidthPercent=t,this}},rb=class extends En{constructor(t,n,r){super("ring",t,n,r),this._state.innerRadiusPercent=60}innerRadius(t){return this._state.innerRadiusPercent=t,this}},ib=class extends En{constructor(t,n,r){super("spiral",t,n,r),this._state.turns=3,this._state.thicknessPercent=15,this._state.spiralDirection=1}turns(t){return this._state.turns=t,this}thickness(t){return this._state.thicknessPercent=t,this}direction(t){return this._state.spiralDirection=t,this}},ob=class extends En{constructor(t,n,r){super("gear",t,n,r),this._state.teeth=8,this._state.toothDepthPercent=25}teeth(t){return this._state.teeth=t,this}toothDepth(t){return this._state.toothDepthPercent=t,this}holeRadius(t){return this._state.holeRadiusPercent=t,this}},sb=class extends En{constructor(t,n,r){super("arrow",t,n,r),this._state.headWidthPercent=100,this._state.headLengthPercent=35,this._state.shaftWidthPercent=35}headWidth(t){return this._state.headWidthPercent=t,this}headLength(t){return this._state.headLengthPercent=t,this}shaftWidth(t){return this._state.shaftWidthPercent=t,this}},ab=class extends En{constructor(t,n,r){super("heart",t,n,r),this._state.lobeRadiusPercent=50,this._state.cleftDepthPercent=25}lobeRadius(t){return this._state.lobeRadiusPercent=t,this}cleftDepth(t){return this._state.cleftDepthPercent=t,this}},cb=class extends En{constructor(t,n,r){super("lightning",t,n,r),this._state.boltSegments=3,this._state.boltJaggednessPercent=40,this._state.boltWidthPercent=30}segments(t){return this._state.boltSegments=t,this}jaggedness(t){return this._state.boltJaggednessPercent=t,this}thickness(t){return this._state.boltWidthPercent=t,this}},lb=class extends En{constructor(t,n,r){super("cloud",t,n,r),this._state.cloudBumps=5,this._state.cloudPuffinessPercent=60}bumps(t){return this._state.cloudBumps=t,this}puffiness(t){return this._state.cloudPuffinessPercent=t,this}},db=class extends En{constructor(t,n,r){super("speechBubble",t,n,r),this._state.tailAngleDeg=45,this._state.tailLengthPercent=40,this._state.tailWidthPercent=25}tailAngle(t){return this._state.tailAngleDeg=t,this}tailLength(t){return this._state.tailLengthPercent=t,this}tailWidth(t){return this._state.tailWidthPercent=t,this}},$o=class extends ln{add(t){let n="build"in t&&typeof t.build=="function"?t.build():t,r=this._state.children??[];return this._state.children=[...r,n],this}addAll(...t){for(let n of t)this.add(n);return this}children(t){return this._state.children=t.map(n=>"build"in n&&typeof n.build=="function"?n.build():n),this}},ub=class extends $o{constructor(t){super("hyperlink"),t!==void 0&&(this._state.href=t)}href(t){return this._state.href=t,this}hrefXlink(t){return this._state.hrefXlink=t,this}target(t){return this._state.linkTarget=t,this}download(t){return this._state.linkDownload=t,this}rel(t){return this._state.linkRel=t,this}ping(t){return this._state.linkPing=t,this}hreflang(t){return this._state.linkHreflang=t,this}type(t){return this._state.linkType=t,this}referrerPolicy(t){return this._state.linkReferrerPolicy=t,this}},fb=class extends $o{constructor(){super("switch")}},pb=class extends $o{constructor(){super("container")}},mb=class extends ln{constructor(t){super("view"),t&&(this._state.viewBoxX=t.x,this._state.viewBoxY=t.y,this._state.viewBoxWidth=t.width,this._state.viewBoxHeight=t.height)}viewBox(t,n,r,i){return this._state.viewBoxX=t,this._state.viewBoxY=n,this._state.viewBoxWidth=r,this._state.viewBoxHeight=i,this}name(t){return this._state.viewName=t,this}preserveAspectRatio(t){return this._state.viewPreserveAspectRatio=t,this}zoomAndPan(t){return this._state.viewZoomAndPan=t,this}viewTarget(t){return this._state.viewTarget=t,this}},gb=class extends $o{constructor(t=0,n=0,r=100,i=100){super("svg"),this._state.svgX=t,this._state.svgY=n,this._state.svgWidth=r,this._state.svgHeight=i}position(t,n){return this._state.svgX=t,this._state.svgY=n,this}size(t,n){return this._state.svgWidth=t,this._state.svgHeight=n,this}viewBox(t,n,r,i){return this._state.svgViewBoxX=t,this._state.svgViewBoxY=n,this._state.svgViewBoxWidth=r,this._state.svgViewBoxHeight=i,this}preserveAspectRatio(t){return this._state.svgPreserveAspectRatio=t,this}asRoot(t=!0){return this._state.isRootSvg=t,this}},hb=class extends ln{constructor(t){super("shape-reference"),t!==void 0&&(this._state.targetShapeId=t)}target(t){return this._state.targetShapeId=t,this}offset(t,n){return this._state.offsetX=t,this._state.offsetY=n,this}size(t,n){return this._state.width=t,this._state.height=n,this}},Cf=class extends ln{position(t,n){return this._state.x=t,this._state.y=n,this}size(t,n){return this._state.width=t,this._state.height=n,this}src(t){return this._state.href=t,this}mimeType(t){return this._state.mediaMimeType=t,this}naturalDuration(t){return this._state.naturalDuration=t,this}begin(t){return this._state.begin=t,this}trim(t,n){return this._state.trimStart=t,this._state.trimEnd=n,this}volume(t){return this._state.volume=t,this}muted(t=!0){return this._state.muted=t,this}loop(t=!0){return this._state.loop=t,this}playbackRate(t){return this._state.playbackRate=t,this}fade(t,n){return this._state.fadeInDuration=t,this._state.fadeOutDuration=n,this}language(t){return this._state.systemLanguage=t,this}},yb=class extends Cf{constructor(t){super("video"),this._state.mediaKind="video",t!==void 0&&(this._state.href=t)}poster(t){return this._state.posterHref=t,this}sourceRect(t){return this._state.sourceRect=t,this}},Sb=class extends Cf{constructor(t){super("audio"),this._state.mediaKind="audio",t!==void 0&&(this._state.href=t)}},bb=class extends ln{constructor(t=[]){super("path"),this._state.pathPoints=[...t],this._state.pathCurveType="cubic",this._state.pathClosed=!1}points(t){return this._state.pathPoints=[...t],this}addPoint(t,n){let r=this._state.pathPoints??[];return r.push({x:t,y:n}),this._state.pathPoints=r,this}curveType(t){return this._state.pathCurveType=t,this}closed(t=!0){return this._state.pathClosed=t,this}tension(t){return this._state.pathTension=t,this}arcParams(t){return this._state.pathArcParams=t,this}markerStart(t){return this._state.startEndpoint=t,this}markerEnd(t){return this._state.endEndpoint=t,this}markers(t,n){return this._state.startEndpoint=t,this._state.endEndpoint=n,this}toD(){let t=this._state.pathPoints??[],n=this._state.pathCurveType??"CUBIC",r=this._state.pathClosed??!1,i=this._state.pathTension??.5,o=this._state.pathArcParams;return pr(t,n,r,i,o)}},vb=class extends ln{constructor(t=[]){super("polyline"),this._state.polylinePoints=[...t],this._state.polylineClosed=!1}points(t){return this._state.polylinePoints=[...t],this}addPoint(t,n){let r=this._state.polylinePoints??[];return r.push({x:t,y:n}),this._state.polylinePoints=r,this}closed(t=!0){return this._state.polylineClosed=t,this}markerStart(t){return this._state.startEndpoint=t,this}markerEnd(t){return this._state.endEndpoint=t,this}markers(t,n){return this._state.startEndpoint=t,this._state.endEndpoint=n,this}},xb=class extends ln{constructor(t,n,r,i,o){super("image"),this._state.x=t,this._state.y=n,this._state.width=r,this._state.height=i,this._state.href=o}position(t,n){return this._state.x=t,this._state.y=n,this}size(t,n){return this._state.width=t,this._state.height=n,this}src(t){return this._state.href=t,this}preserveAspectRatio(t){return this._state.preserveAspectRatio=t,this}};var Af=class{_x1;_y1;_x2;_y2;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(t=0,n=0,r=1,i=0){this._x1=t,this._y1=n,this._x2=r,this._y2=i,this._id=me()}stop(t,n,r=1){return this._stops.push({offset:t,color:n,opacity:r}),this}direction(t,n,r,i){return this._x1=t,this._y1=n,this._x2=r,this._y2=i,this}spread(t){return this._spreadMethod=t,this}opacity(t){return this._opacity=t,this}build(){return{type:"linear-gradient",id:this._id,x1:this._x1,y1:this._y1,x2:this._x2,y2:this._y2,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},Nf=class{_cx=.5;_cy=.5;_fx=.5;_fy=.5;_r=.5;_ry=.5;_rotation=0;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(){this._id=me()}center(t,n){return this._cx=t,this._cy=n,this}focus(t,n){return this._fx=t,this._fy=n,this}radius(t,n){return this._r=t,this._ry=n??t,this}rotation(t){return this._rotation=t,this}stop(t,n,r=1){return this._stops.push({offset:t,color:n,opacity:r}),this}spread(t){return this._spreadMethod=t,this}opacity(t){return this._opacity=t,this}build(){return{type:"radial-gradient",id:this._id,cx:this._cx,cy:this._cy,fx:this._fx,fy:this._fy,r:this._r,ry:this._ry,rotation:this._rotation,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},Ef=class{_patternType;_color;_backgroundColor;_scale=1;_rotation=0;_opacity=1;_patternParams;_id;_svgContent;_width;_height;_patternUnits;_patternContentUnits;_patternTransform;_viewBox;_preserveAspectRatio;_x;_y;_customPatternId;constructor(t="stripes",n="#000000",r="#ffffff"){this._patternType=t,this._color=n,this._backgroundColor=r,this._id=me()}scale(t){return this._scale=t,this}rotation(t){return this._rotation=t,this}opacity(t){return this._opacity=t,this}params(t){return this._patternParams=t,this}svgContent(t){return this._svgContent=t,this}size(t,n){return this._width=t,this._height=n,this}patternUnits(t){return this._patternUnits=t,this}patternContentUnits(t){return this._patternContentUnits=t,this}patternTransform(t){return this._patternTransform=t,this}viewBox(t){return this._viewBox=t,this}preserveAspectRatio(t){return this._preserveAspectRatio=t,this}position(t,n){return this._x=t,this._y=n,this}customPatternId(t){return this._customPatternId=t,this}build(){let t,n,r;if(this._svgContent!==void 0)t=this._svgContent,n=this._width??10,r=this._height??10;else{let o=bg(this._patternType,this._scale,this._color,this._backgroundColor,this._patternParams);t=o.svgContent,n=this._width??o.width,r=this._height??o.height}let i={type:"pattern",id:this._id,patternType:this._svgContent!==void 0?"custom":this._patternType,color:this._color,backgroundColor:this._backgroundColor,scale:this._scale,rotation:this._rotation,opacity:this._opacity,svgContent:t,width:n,height:r,patternUnits:this._patternUnits??"userSpaceOnUse",patternParams:this._patternParams,patternTransform:this._patternTransform??(this._rotation?`rotate(${this._rotation})`:void 0)};return this._patternContentUnits&&(i.patternContentUnits=this._patternContentUnits),this._viewBox&&(i.viewBox=this._viewBox),this._preserveAspectRatio&&(i.preserveAspectRatio=this._preserveAspectRatio),this._x!==void 0&&(i.x=this._x),this._y!==void 0&&(i.y=this._y),this._customPatternId&&(i.customPatternId=this._customPatternId),i}};function g2(e=0,t=0,n=1,r=0){return new Af(e,t,n,r)}function h2(){return new Nf}function y2(e="stripes",t="#000000",n="#ffffff"){return new Ef(e,t,n)}var QR={rows:4,cols:4,style:"classic",tabDepthPercent:20,tabPattern:"random",seed:1},S2=.04,b2=0;function v2(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let n=t;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function xe(e){return Number(e.toFixed(3)).toString()}function x2(e,t,n,r,i,o,s,a,c,l,d,u){return[[0,0],[.2,a],[.5+c+d,-o+l],[.5-o+c,o+l],[.5-2*o+c-d,3*o+l],[.5+2*o+c-d,3*o+l],[.5+o+c,o+l],[.5+c+d,-o+l],[.8,u],[1,0]].map(([p,m])=>{let g=t+p*r,h=n+m*i*s;return e?{x:g,y:h}:{x:h,y:g}})}function XR(e,t,n,r,i,o,s,a,c,l,d){let u=[],f=(v,w)=>c==="alternating"?0:v+l()*(w-v),p=()=>l()<.5,m=f(-a,a),g=c==="alternating"?d%2===0:p(),h=null,y=m,S=f(-a,a),b=f(-a,a),I=f(-a,a);m=f(-a,a);for(let v=0;v<e;v++){v>0&&(h=g,g=c==="alternating"?(d+v)%2===0:p(),y=g===h?-m:m,S=f(-a,a),b=f(-a,a),I=f(-a,a),m=f(-a,a));let w=g?-1:1,k=n+v*i;u.push(x2(t,k,r,i,o,s,w,y,S,b,I,m))}return u}function YR(e,t,n,r,i,o,s){let a=2*o;return[[0,0],[.2,0],[.4,0],[.4,a],[.4,a],[.6,a],[.6,a],[.6,0],[.8,0],[1,0]].map(([l,d])=>{let u=t+l*r,f=n+d*i*s;return e?{x:u,y:f}:{x:f,y:u}})}function qR(e,t){return e+` C ${xe(t[1].x)} ${xe(t[1].y)} ${xe(t[2].x)} ${xe(t[2].y)} ${xe(t[3].x)} ${xe(t[3].y)} C ${xe(t[4].x)} ${xe(t[4].y)} ${xe(t[5].x)} ${xe(t[5].y)} ${xe(t[6].x)} ${xe(t[6].y)} C ${xe(t[7].x)} ${xe(t[7].y)} ${xe(t[8].x)} ${xe(t[8].y)} ${xe(t[9].x)} ${xe(t[9].y)}`}function ZR(e,t){return e+` C ${xe(t[8].x)} ${xe(t[8].y)} ${xe(t[7].x)} ${xe(t[7].y)} ${xe(t[6].x)} ${xe(t[6].y)} C ${xe(t[5].x)} ${xe(t[5].y)} ${xe(t[4].x)} ${xe(t[4].y)} ${xe(t[3].x)} ${xe(t[3].y)} C ${xe(t[2].x)} ${xe(t[2].y)} ${xe(t[1].x)} ${xe(t[1].y)} ${xe(t[0].x)} ${xe(t[0].y)}`}function I2(e,t={}){let n={...QR,...t};if(n.rows<1||n.cols<1)throw new Error("generatePuzzlePieces: rows and cols must be >= 1");if(!Number.isFinite(e.width)||!Number.isFinite(e.height))throw new Error("generatePuzzlePieces: bounds must have finite width/height");if(e.width<=0||e.height<=0)throw new Error("generatePuzzlePieces: bounds must have positive width/height");let{rows:r,cols:i,style:o,tabDepthPercent:s,tabPattern:a,seed:c}=n,l=v2(c),d=e.width/i,u=e.height/r,f=Math.max(0,Math.min(.4,s/200)),p=(o==="classic"||o==="curved")&&f>0,m=o==="square-tabs"&&f>0,g=o==="classic"&&a==="random"?S2:b2,h=[];for(let b=0;b<r-1;b++){let I=e.y+(b+1)*u;if(p)h.push(XR(i,!0,e.x,I,d,u,f,g,a,l,b));else if(m){let v=[];for(let w=0;w<i;w++){let k=a==="alternating"?(b+w)%2===0?1:-1:l()<.5?1:-1;v.push(YR(!0,e.x+w*d,I,d,u,f,k))}h.push(v)}else h.push(new Array(i).fill(null))}let y=[];for(let b=0;b<i-1;b++){let I=e.x+(b+1)*d;if(p)y.push(XR(r,!1,e.y,I,u,d,f,g,a,l,b));else if(m){let v=[];for(let w=0;w<r;w++){let k=a==="alternating"?(w+b)%2===0?1:-1:l()<.5?1:-1;v.push(YR(!1,e.y+w*u,I,u,d,f,k))}y.push(v)}else y.push(new Array(r).fill(null))}let S=[];for(let b=0;b<r;b++)for(let I=0;I<i;I++){let v=e.x+I*d,w=e.y+b*u,k=v+d,C=w+u,P=`M ${xe(v)} ${xe(w)}`;if(b===0)P+=` L ${xe(k)} ${xe(w)}`;else{let R=h[b-1][I];R?P=qR(P,R):P+=` L ${xe(k)} ${xe(w)}`}if(I===i-1)P+=` L ${xe(k)} ${xe(C)}`;else{let R=y[I][b];R?P=qR(P,R):P+=` L ${xe(k)} ${xe(C)}`}if(b===r-1)P+=` L ${xe(v)} ${xe(C)}`;else{let R=h[b][I];R?P=ZR(P,R):P+=` L ${xe(v)} ${xe(C)}`}if(I===0)P+=` L ${xe(v)} ${xe(w)}`;else{let R=y[I-1][b];R?P=ZR(P,R):P+=` L ${xe(v)} ${xe(w)}`}P+=" Z",S.push({id:`puzzle-${c}-r${b}-c${I}`,row:b,col:I,d:P})}return S}var tC=[1,2,3,4,5,6,7,8,9],w2={easy:{minGivens:40,maxGivens:45,maxRating:"singles"},medium:{minGivens:34,maxGivens:39,maxRating:"hidden-singles"},hard:{minGivens:28,maxGivens:33,maxRating:"search"},expert:{minGivens:24,maxGivens:27,maxRating:"search"}};function rl(e){return e.map(t=>[...t])}function k2(){return Array.from({length:9},()=>Array.from({length:9},()=>0))}function nC(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let n=t;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function rC(e,t){let n=[...e];for(let r=n.length-1;r>0;r--){let i=Math.floor(t()*(r+1));[n[r],n[i]]=[n[i],n[r]]}return n}function da(e){return 1<<e-1}function iC(e){let t=0,n=e;for(;n;)n&=n-1,t++;return t}function P2(e){for(let t=1;t<=9;t++)if(e===da(t))return t;return 0}function wb(e,t){return Math.floor(e/3)*3+Math.floor(t/3)}function Ib(e){let t=0;for(let n of e)for(let r of n)r!==0&&t++;return t}function T2(e){if(!Number.isFinite(e))return 1;let t=Math.floor(e);return t===0?1:t}function oC(e,t){if(!Array.isArray(e)||e.length!==9)return t.push("Grid must contain 9 rows."),!1;let n=!0;for(let r=0;r<9;r++){if(!Array.isArray(e[r])||e[r].length!==9){t.push(`Row ${r+1} must contain 9 cells.`),n=!1;continue}for(let i=0;i<9;i++){let o=e[r][i];(!Number.isInteger(o)||o<0||o>9)&&(t.push(`Cell R${r+1}C${i+1} must be a digit from 0 to 9.`),n=!1)}}return n}function sC(e,t){let n=!0,r=(i,o)=>{let s=0;for(let a of o){if(a===0)continue;let c=da(a);if(s&c){t.push(`${i} contains duplicate ${a}.`),n=!1;return}s|=c}};for(let i=0;i<9;i++)r(`Row ${i+1}`,e[i]);for(let i=0;i<9;i++)r(`Column ${i+1}`,e.map(o=>o[i]));for(let i=0;i<9;i+=3)for(let o=0;o<9;o+=3){let s=[];for(let a=i;a<i+3;a++)for(let c=o;c<o+3;c++)s.push(e[a][c]);r(`Box ${Math.floor(i/3)*3+Math.floor(o/3)+1}`,s)}return n}function kb(e){let t=Array.from({length:9},()=>0),n=Array.from({length:9},()=>0),r=Array.from({length:9},()=>0);for(let i=0;i<9;i++)for(let o=0;o<9;o++){let s=e[i][o];if(s===0)continue;let a=da(s),c=wb(i,o);if(t[i]&a||n[o]&a||r[c]&a)return null;t[i]|=a,n[o]|=a,r[c]|=a}return{rows:t,cols:n,boxes:r}}function Pb(e,t,n,r,i){return 511&~(n[e]|r[t]|i[wb(e,t)])}function aC(e,t,n){let r=kb(e);if(!r)return[];let i=rl(e),o=[],{rows:s,cols:a,boxes:c}=r,l=()=>{if(o.length>=t)return;let d=-1,u=-1,f=0,p=10;for(let g=0;g<9;g++){for(let h=0;h<9;h++){if(i[g][h]!==0)continue;let y=Pb(g,h,s,a,c),S=iC(y);if(S===0)return;if(S<p&&(d=g,u=h,f=y,p=S,S===1))break}if(p===1)break}if(d===-1){o.push(rl(i));return}let m=tC.filter(g=>f&da(g));n&&(m=rC(m,n));for(let g of m){let h=da(g),y=wb(d,u);if(i[d][u]=g,s[d]|=h,a[u]|=h,c[y]|=h,l(),c[y]&=~h,a[u]&=~h,s[d]&=~h,i[d][u]=0,o.length>=t)return}};return l(),o}function R2(e){let t=k2(),n=nC(e),[r]=aC(t,1,n);if(!r)throw new Error("generateSudokuPuzzle: failed to generate solved grid");return r}function C2(e){let t=kb(e);if(!t)return null;for(let n=0;n<9;n++)for(let r=0;r<9;r++){if(e[n][r]!==0)continue;let i=Pb(n,r,t.rows,t.cols,t.boxes);if(iC(i)===1)return{row:n,col:r,value:P2(i)}}return null}function A2(e){let t=kb(e);if(!t)return null;let n=r=>{for(let i of tC){let o=da(i),s=null;for(let a of r)if(!(e[a.row][a.col]!==0||!(Pb(a.row,a.col,t.rows,t.cols,t.boxes)&o))){if(s){s=null;break}s=a}if(s)return{...s,value:i}}return null};for(let r=0;r<9;r++){let i=n(Array.from({length:9},(o,s)=>({row:r,col:s})));if(i)return i}for(let r=0;r<9;r++){let i=n(Array.from({length:9},(o,s)=>({row:s,col:r})));if(i)return i}for(let r=0;r<9;r+=3)for(let i=0;i<9;i+=3){let o=[];for(let a=r;a<r+3;a++)for(let c=i;c<i+3;c++)o.push({row:a,col:c});let s=n(o);if(s)return s}return null}function JR(e){let t=rl(e),n=!1;for(;Ib(t)<81;){let r=C2(t);if(r){t[r.row][r.col]=r.value;continue}let i=A2(t);if(i){n=!0,t[i.row][i.col]=i.value;continue}return"search"}return n?"hidden-singles":"singles"}function eC(e,t){let n={singles:0,"hidden-singles":1,search:2};return n[e]<=n[t]}function Of(e,t={}){let n=[];return oC(e,n)?sC(e,n)?aC(e,Math.max(1,Math.floor(t.maxSolutions??2))):[]:[]}function N2(e){let t=[];if(!oC(e,t))return{valid:!1,unique:!1,solution:null,errors:t};if(sC(e,t),t.length>0)return{valid:!1,unique:!1,solution:null,errors:t};let r=Of(e,{maxSolutions:2});return r.length===0?t.push("Puzzle has no solution."):r.length>1&&t.push("Puzzle has more than one solution."),{valid:t.length===0,unique:r.length===1,solution:r[0]?rl(r[0]):null,errors:t}}function E2(e){let t=e.difficulty,n=w2[t];if(!n)throw new Error(`generateSudokuPuzzle: unsupported difficulty "${t}"`);let r=T2(e.seed);for(let i=0;i<30;i++){let o=r+i*104729>>>0,s=nC(o),a=R2(o),c=rl(a),l=n.minGivens+Math.floor(s()*(n.maxGivens-n.minGivens+1)),d=rC(Array.from({length:81},(m,g)=>({row:Math.floor(g/9),col:g%9})),s);for(let m of d){if(Ib(c)<=l)break;let g=c[m.row][m.col];if(c[m.row][m.col]=0,Of(c,{maxSolutions:2}).length!==1){c[m.row][m.col]=g;continue}let y=JR(c);eC(y,n.maxRating)||(c[m.row][m.col]=g)}let u=Ib(c),f=JR(c);if(Of(c,{maxSolutions:2}).length===1&&u>=n.minGivens&&u<=n.maxGivens&&eC(f,n.maxRating))return{puzzle:c,solution:a,difficulty:t,seed:r,givens:u,rating:f}}throw new Error(`generateSudokuPuzzle: unable to generate a ${t} puzzle`)}var cC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var O2={E:{direction:"E",dr:0,dc:1},S:{direction:"S",dr:1,dc:0},SE:{direction:"SE",dr:1,dc:1},NE:{direction:"NE",dr:-1,dc:1},W:{direction:"W",dr:0,dc:-1},N:{direction:"N",dr:-1,dc:0},NW:{direction:"NW",dr:-1,dc:-1},SW:{direction:"SW",dr:1,dc:-1}};function dC(e){if(!Number.isFinite(e))return 1;let t=Math.floor(e);return t===0?1:t}function uC(e){let t=e>>>0;return()=>{t=t+1831565813>>>0;let n=t;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function ua(e){let t=globalThis.Intl.Segmenter;return t?Array.from(new t(void 0,{granularity:"grapheme"}).segment(e),n=>n.segment.normalize("NFC")):Array.from(e.normalize("NFC"))}function D2(e,t,n,r){return e>=0&&t>=0&&e<r&&t<n}function Tb(e,t){return Array.from({length:t},()=>Array.from({length:e},()=>!0))}function fC(e,t,n,r){if(!n)return Tb(e,t);if(!Array.isArray(n)||n.length!==t)return r.push(`Mask must contain exactly ${t} rows.`),Tb(e,t);let i=[];for(let o=0;o<t;o++){if(!Array.isArray(n[o])||n[o].length!==e)return r.push(`Mask row ${o+1} must contain exactly ${e} cells.`),Tb(e,t);i.push(n[o].map(Boolean))}return i}function $2(e){let t=0;for(let n of e)for(let r of n)r&&t++;return t}function M2(e){return e.trim().normalize("NFC")}function z2(e){return e.replace(/\r/g,"").split(/[,\n]+/).map(t=>t.trim()).filter(t=>t.length>0)}function pC(e,t){let n=[];return e.across&&(n.push("E"),t&&n.push("W")),e.down&&(n.push("S"),t&&n.push("N")),e.diagonal&&(n.push("SE","NE"),t&&n.push("NW","SW")),n}function F2(e,t,n,r,i,o,s,a){let c=ua(e),l=[];for(let d=0;d<c.length;d++){let u=t+r.dr*d,f=n+r.dc*d;if(!D2(u,f,o,s)||!i[u][f])return null;l.push({row:u,col:f,grapheme:c[d]})}return{word:e,graphemes:c,row:t,col:n,direction:r.direction,dr:r.dr,dc:r.dc,cells:l,jitter:a}}function mC(e,t,n,r,i,o){let s=[];for(let a of t){let c=O2[a];for(let l=0;l<i;l++)for(let d=0;d<r;d++){let u=F2(e,l,d,c,n,r,i,o());u&&s.push(u)}}return s}function gC(e){let t=[],n=[],r=[],i=Math.floor(e.width),o=Math.floor(e.height);(!Number.isInteger(i)||i<2||i>64)&&t.push("Width must be an integer from 2 to 64."),(!Number.isInteger(o)||o<2||o>64)&&t.push("Height must be an integer from 2 to 64.");let s=pC(e.axes,e.allowBackwards);s.length===0&&t.push("At least one word direction must be enabled.");let a=fC(Math.max(1,i),Math.max(1,o),e.mask,t),c=$2(a);c===0&&t.push("Mask must contain at least one active cell.");let l=new Set,d=[];for(let p of e.words){let m=M2(p);if(m){if(/\s/u.test(m)){r.push({input:p,reason:"Words cannot contain whitespace."});continue}if(l.has(m)){r.push({input:p,reason:"Duplicate word."});continue}l.add(m),d.push(m)}}d.length===0&&t.push("Enter at least one word.");let u=uC(dC(e.seed));if(t.length===0)for(let p=d.length-1;p>=0;p--){let m=d[p];mC(m,s,a,i,o,u).length===0&&(r.push({input:m,reason:"No legal placement exists for the current size, mask, and directions."}),d.splice(p,1))}r.length>0&&t.push(`${r.length} word${r.length===1?"":"s"} rejected.`);let f=Math.max(0,c);return d.length>f&&n.push("The word count exceeds the active cell count; overlaps may be required for this puzzle."),{valid:t.length===0,acceptedWords:d,rejectedWords:r,errors:t,warnings:n,minWords:1,maxWords:f,activeCells:c,directions:s}}function L2(e,t){for(let n of t.cells){let r=e[n.row][n.col];if(r!==null&&r!==n.grapheme)return!0}return!1}function _2(e,t){let n=[];for(let r of t.cells)e[r.row][r.col]===null&&(n.push({row:r.row,col:r.col}),e[r.row][r.col]=r.grapheme);return n}function B2(e,t){for(let n of t)e[n.row][n.col]=null}function lC(e,t){let n=0;for(let r of t.cells)e[r.row][r.col]===r.grapheme&&n++;return n}function V2(e){return{word:e.word,row:e.row,col:e.col,direction:e.direction,path:e.cells.map(t=>({...t}))}}function G2(e){let t=e.fillerAlphabet??cC,n=typeof t=="string"?ua(t):t.flatMap(i=>ua(i)),r=n.filter((i,o)=>i.trim()&&n.indexOf(i)===o);return r.length>0?r:ua(cC)}function j2(e){let t=Math.floor(e.width),n=Math.floor(e.height),r=dC(e.seed),i=gC({...e,width:t,height:n,seed:r});if(!i.valid)throw new Error(`generateWordSearch: ${i.errors[0]??"invalid options"}`);let o=fC(t,n,e.mask,[]),s=Math.max(1,Math.floor(e.maxBacktrackNodes??15e4));for(let a=0;a<24;a++){let c=uC(r+a*104729>>>0),l=i.directions,d=new Map;for(let S of i.acceptedWords)d.set(S,mC(S,l,o,t,n,c));let u=[...i.acceptedWords].sort((S,b)=>{let I=d.get(S)?.length??0,v=d.get(b)?.length??0;return I!==v?I-v:ua(b).length-ua(S).length}),f=Array.from({length:n},(S,b)=>Array.from({length:t},(I,v)=>o[b][v]?null:"")),p=[],m=new Map,g=0,h=S=>{if(++g>s)return!1;if(S>=u.length)return!0;let b=u[S],I=[...d.get(b)??[]].filter(v=>!L2(f,v)).sort((v,w)=>{let k=lC(f,w)-lC(f,v);if(k!==0)return k;let C=(m.get(v.direction)??0)-(m.get(w.direction)??0);return C!==0?C:v.jitter-w.jitter});for(let v of I){let w=_2(f,v);if(p.push(V2(v)),m.set(v.direction,(m.get(v.direction)??0)+1),h(S+1))return!0;m.set(v.direction,(m.get(v.direction)??1)-1),p.pop(),B2(f,w)}return!1};if(!h(0))continue;let y=G2(e);for(let S=0;S<n;S++)for(let b=0;b<t;b++)o[S][b]?f[S][b]===null&&(f[S][b]=y[Math.floor(c()*y.length)]):f[S][b]="";return{width:t,height:n,grid:f,mask:o.map(S=>[...S]),normalizedWords:[...i.acceptedWords],placements:[...p],seed:r,title:e.title,creator:e.creator,lint:i}}throw new Error("generateWordSearch: unable to place all words with the current settings")}function U2(e,t,n){let r=!1;for(let i=0,o=n.length-1;i<n.length;o=i++){let s=n[i],a=n[o];s.y>t!=a.y>t&&e<(a.x-s.x)*(t-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function H2(){let e=[];for(let t=0;t<10;t++){let n=t%2===0?.5:.23,r=-Math.PI/2+t*Math.PI/5;e.push({x:.5+Math.cos(r)*n,y:.5+Math.sin(r)*n})}return e}function K2(e,t,n){let r=Math.max(1,Math.floor(e)),i=Math.max(1,Math.floor(t)),o=H2();return Array.from({length:i},(s,a)=>Array.from({length:r},(c,l)=>{let d=(l+.5)/r,u=(a+.5)/i,f=d*2-1,p=u*2-1;switch(n){case"rectangle":return!0;case"circle":return f*f+p*p<=1;case"triangle":return u>=.08&&u<=.95&&Math.abs(f)<=u;case"diamond":return Math.abs(f)+Math.abs(p)<=1;case"star":return U2(d,u,o);case"heart":{let m=f*1.25,g=-p*1.25;return Math.pow(m*m+g*g-1,3)-m*m*g*g*g<=0}case"cross":return Math.abs(f)<=.32||Math.abs(p)<=.32;default:return!0}}))}function Df(e,t){let{width:n,height:r,data:i}=e;if(!Number.isInteger(n)||!Number.isInteger(r)||n<0||r<0)throw new Error(`${t}: image dimensions must be non-negative integers, got ${n}x${r}`);if(i.length!==n*r*4)throw new Error(`${t}: data length ${i.length} does not match ${n}x${r} RGBA (${n*r*4})`)}function Ab(e,t,n){return .2126*e+.7152*t+.0722*n}function Rb(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}var W2=.95047,X2=1,Y2=1.08883,q2=Math.pow(6/29,3),Z2=1/(3*Math.pow(6/29,2));function Cb(e){return e>q2?Math.cbrt(e):e*Z2+4/29}function $f(e,t,n,r){let i=Rb(e),o=Rb(t),s=Rb(n),a=.4124564*i+.3575761*o+.1804375*s,c=.2126729*i+.7151522*o+.072175*s,l=.0193339*i+.119192*o+.9503041*s,d=Cb(a/W2),u=Cb(c/X2),f=Cb(l/Y2);r[0]=116*u-16,r[1]=500*(d-u),r[2]=200*(u-f)}var Yi=Math.PI/180,hC=Math.pow(25,7);function Nb(e,t,n,r,i,o){let s=Math.hypot(t,n),a=Math.hypot(i,o),c=(s+a)/2,l=Math.pow(c,7),d=.5*(1-Math.sqrt(l/(l+hC))),u=(1+d)*t,f=(1+d)*i,p=Math.hypot(u,n),m=Math.hypot(f,o),g=p===0?0:(Math.atan2(n,u)/Yi+360)%360,h=m===0?0:(Math.atan2(o,f)/Yi+360)%360,y=r-e,S=m-p,b=0;p*m!==0&&(b=h-g,b>180?b-=360:b<-180&&(b+=360));let I=2*Math.sqrt(p*m)*Math.sin(b/2*Yi),v=(e+r)/2,w=(p+m)/2,k;if(p*m===0)k=g+h;else{let V=g+h;Math.abs(g-h)<=180?k=V/2:V<360?k=(V+360)/2:k=(V-360)/2}let C=1-.17*Math.cos((k-30)*Yi)+.24*Math.cos(2*k*Yi)+.32*Math.cos((3*k+6)*Yi)-.2*Math.cos((4*k-63)*Yi),P=30*Math.exp(-Math.pow((k-275)/25,2)),R=Math.pow(w,7),N=2*Math.sqrt(R/(R+hC)),M=Math.pow(v-50,2),A=1+.015*M/Math.sqrt(20+M),$=1+.045*w,_=1+.015*w*C,z=-Math.sin(2*P*Yi)*N,j=y/A,G=S/$,W=I/_;return Math.sqrt(j*j+G*G+W*W+z*G*W)}function Eb(e,t){return e.width===t.width&&e.height===t.height}function Mf(e){let t=e.data,n=new Uint8ClampedArray(t.length);for(let r=0;r<t.length;r+=4){let i=t[r+3];if(n[r+3]=i,i===255)n[r]=t[r],n[r+1]=t[r+1],n[r+2]=t[r+2];else if(i!==0){let o=i/255;n[r]=Math.round(t[r]*o),n[r+1]=Math.round(t[r+1]*o),n[r+2]=Math.round(t[r+2]*o)}}return n}function zf(e,t){let n=e.data,r=e.width*e.height,i=new Uint8ClampedArray(r*3);for(let o=0;o<r;o++){let s=o*4,a=o*3,c=n[s+3]/255;if(c===1)i[a]=n[s],i[a+1]=n[s+1],i[a+2]=n[s+2];else if(c===0)i[a]=t.r,i[a+1]=t.g,i[a+2]=t.b;else{let l=1-c;i[a]=Math.round(n[s]*c+t.r*l),i[a+1]=Math.round(n[s+1]*c+t.g*l),i[a+2]=Math.round(n[s+2]*c+t.b*l)}}return i}var yC=6.502500000000001,SC=(.03*255)**2;function Q2(e,t){let n=new Float64Array(e*2+1),r=0;for(let i=-e;i<=e;i++){let o=Math.exp(-(i*i)/(2*t*t));n[i+e]=o,r+=o}for(let i=0;i<n.length;i++)n[i]/=r;return n}function il(e,t,n,r,i,o,s){for(let a=0;a<n;a++){let c=a*t;for(let l=0;l<t;l++){let d=0;for(let u=-i;u<=i;u++){let f=l+u;f<0?f=0:f>=t&&(f=t-1),d+=e[c+f]*r[u+i]}o[c+l]=d}}for(let a=0;a<n;a++)for(let c=0;c<t;c++){let l=0;for(let d=-i;d<=i;d++){let u=a+d;u<0?u=0:u>=n&&(u=n-1),l+=o[u*t+c]*r[d+i]}s[a*t+c]=l}}function Ff(e,t,n,r){if(e.length!==n*r||t.length!==n*r)throw new Error(`ssimPlane: plane length ${e.length}/${t.length} does not match ${n}x${r}`);let i=Math.min(n,r);if(i<3){for(let I=0;I<e.length;I++)if(e[I]!==t[I])return 0;return 1}let o=11;i<o&&(o=i%2===0?i-1:i);let s=(o-1)/2,a=Q2(s,1.5),c=n*r,l=new Float64Array(c),d=new Float64Array(c),u=new Float64Array(c);for(let I=0;I<c;I++)l[I]=e[I]*e[I],d[I]=t[I]*t[I],u[I]=e[I]*t[I];let f=new Float64Array(c),p=new Float64Array(c),m=new Float64Array(c),g=new Float64Array(c),h=new Float64Array(c),y=new Float64Array(c);il(e,n,r,a,s,f,p),il(t,n,r,a,s,f,m),il(l,n,r,a,s,f,g),il(d,n,r,a,s,f,h),il(u,n,r,a,s,f,y);let S=0,b=0;for(let I=s;I<r-s;I++)for(let v=s;v<n-s;v++){let w=I*n+v,k=p[w],C=m[w],P=k*k,R=C*C,N=g[w]-P,M=h[w]-R,A=y[w]-k*C,$=(2*k*C+yC)*(2*A+SC),_=(P+R+yC)*(N+M+SC);S+=$/_,b++}return b>0?S/b:1}function Ob(e,t,n,r={}){let i=t*n;if(e.length!==i)throw new Error(`severity: field length ${e.length} does not match ${t}x${n}`);let o=r.threshold??2,s=r.minNeighbors??r.minNeighbours??4,a=new Uint8Array(i),c=0;for(let h=0;h<i;h++)e[h]>o&&(a[h]=1,c++);if(c===0)return{differing:0,coherent:0,clusters:0,largestCluster:0,mass:0,score:1};let l=new Uint8Array(i),d=0;for(let h=0;h<n;h++){let y=h*t;for(let S=0;S<t;S++){if(!a[y+S])continue;let b=0;for(let I=-1;I<=1;I++){let v=h+I;if(v<0||v>=n)continue;let w=v*t;for(let k=-1;k<=1;k++){if(k===0&&I===0)continue;let C=S+k;C<0||C>=t||(b+=a[w+C])}}b>=s&&(l[y+S]=1,d++)}}let u=0,f=0,p=0,m=[];for(let h=0;h<i;h++){if(!l[h])continue;u++;let y=0;for(l[h]=0,m.push(h);m.length>0;){let S=m.pop();y++;let b=S%t;b>0&&l[S-1]&&(l[S-1]=0,m.push(S-1)),b+1<t&&l[S+1]&&(l[S+1]=0,m.push(S+1)),S>=t&&l[S-t]&&(l[S-t]=0,m.push(S-t)),S+t<i&&l[S+t]&&(l[S+t]=0,m.push(S+t))}y>f&&(f=y),p+=y*y}let g=i===0?0:Math.min(1,Math.sqrt(p)/i);return{differing:c,coherent:d,clusters:u,largestCluster:f,mass:g,score:1-g}}var J2={r:255,g:255,b:255,a:255};function eH(e,t,n={}){if(Df(e,"compareImages(reference)"),Df(t,"compareImages(candidate)"),!Eb(e,t))throw new Error(`compareImages: cannot compare ${e.width}x${e.height} against ${t.width}x${t.height}`);let r=n.alphaMode??"premultiplied",i=n.deltaEBackground??J2,o=r==="premultiplied"?Mf(e):e.data,s=r==="premultiplied"?Mf(t):t.data,a=e.width,c=e.height,l=a*c,d=0,u=0,f=0;for(let v=0;v<l;v++){let w=v*4,k=o[w]-s[w],C=o[w+1]-s[w+1],P=o[w+2]-s[w+2],R=o[w+3]-s[w+3];if(d+=k*k+C*C+P*P+R*R,k===0&&C===0&&P===0&&R===0)u++;else{let N=Math.max(Math.abs(k),Math.abs(C),Math.abs(P),Math.abs(R));N>f&&(f=N)}}let p=l===0?0:d/(l*4),m=p===0?1/0:10*Math.log10(65025/p),g=u===l,h=1,y=1;if(!g&&!n.skipSsim){let v=bC(o,l),w=bC(s,l),k=0;for(let C=0;C<3;C++)k+=Ff(v.rgb[C],w.rgb[C],a,c);h=k/3,y=Ff(v.luma,w.luma,a,c)}let S={mean:0,p95:0,max:0},b=n.severity&&!g?new Float64Array(l):void 0;!g&&!n.skipDeltaE&&(S=tH(e,t,i,b));let I;return n.severity&&(I=g?{differing:0,coherent:0,clusters:0,largestCluster:0,mass:0,score:1}:Ob(b??new Float64Array(l),a,c)),{width:a,height:c,pixels:l,exactPixels:u,exactRatio:l===0?1:u/l,maxChannelDiff:f,mse:p,rmse:Math.sqrt(p),psnr:m,ssim:h,ssimLuma:y,deltaE:S,deltaEBackground:i,alphaMode:r,lossless:g,severity:I}}function bC(e,t){let n=new Float64Array(t),r=new Float64Array(t),i=new Float64Array(t),o=new Float64Array(t);for(let s=0;s<t;s++){let a=s*4;n[s]=e[a],r[s]=e[a+1],i[s]=e[a+2],o[s]=Ab(e[a],e[a+1],e[a+2])}return{rgb:[n,r,i],luma:o}}function tH(e,t,n,r){let i=zf(e,n),o=zf(t,n),s=e.width*e.height,a=10001,c=new Uint32Array(a),l=new Float64Array(3),d=new Float64Array(3),u=0,f=0;for(let h=0;h<s;h++){let y=h*3,S=i[y],b=i[y+1],I=i[y+2],v=o[y],w=o[y+1],k=o[y+2];if(S===v&&b===w&&I===k){c[0]++;continue}$f(S,b,I,l),$f(v,w,k,d);let C=Nb(l[0],l[1],l[2],d[0],d[1],d[2]);r&&(r[h]=C),u+=C,C>f&&(f=C),c[Math.min(a-1,Math.round(C*100))]++}let p=Math.ceil(s*.95),m=0,g=0;for(let h=0;h<a;h++)if(m+=c[h],m>=p){g=h/100;break}return{mean:s===0?0:u/s,p95:g,max:f}}export{Jf as ANIMATION_MANAGER_INTERPOLATION_POLICY,sb as Arrow,Sb as Audio,Yb as BASE_FILL_LAYER_ID,qb as BASE_STROKE_LAYER_ID,tD as BROWSER_SVG_EXTENSION_URIS,zs as BUILTIN_MARKER_ID_MAP,Xj as CANONICAL_NORMALIZATION_FAULT_POINTS,ho as CC_NS,Hj as COLLAB_PROTOCOL_VERSION,kt as COMMON_PROP_DEFAULTS,Hb as COMMON_TRANSFORM_NODE_DEFAULTS,ny as CONNECTOR_LABEL_BASELINE_LIFT,ty as CONNECTOR_LABEL_FONT_FAMILY,ey as CONNECTOR_LABEL_FONT_SIZE,hk as CSS_GENERIC_FAMILY_NAMES,Tn as CURRENT_SCHEMA_VERSION,ia as CanonicalDocument,WS as Circle,lb as Cloud,pb as Container,$o as ContainerShapeBuilder,nb as Cross,_n as DC_NS,Au as DEFAULT_CONNECTOR_CORNER_RADIUS,L0 as DEFAULT_CONNECTOR_LABEL_OFFSET,F0 as DEFAULT_CONNECTOR_LABEL_POSITION,Ds as DEFAULT_COORDINATE_PRECISION,ru as DEFAULT_FONT_WEIGHT,fs as DEFAULT_RICH_TEXT_STYLE,nj as DOCUMENT_BYTE_KINDS,pn as DOCUMENT_FIELDS,lS as DOCUMENT_FIELD_LIVE_AUTHORITY,Ox as DOCUMENT_IMPORT_INTENTS,rj as DOCUMENT_IMPORT_KINDS,sd as DOCUMENT_INGEST_POLICIES,Yp as DOCUMENT_SECTION_ORDER,US as DocumentBuilder,Oo as DocumentModel,pS as DocumentSession,to as EASING_CURVES,Er as EasingType,XS as Ellipse,Zn as FLOWCHART_GEOMETRY_DEFAULTS,LC as GEOMETRY_TRACK_PROPERTIES,ob as Gear,Ek as HEADLESS_SVG_STYLE_ENVIRONMENT,ab as Heart,ub as Hyperlink,Ke as IDENTITY_AFFINE,eO as INGEST_APPLY_STAGES,GE as INGEST_DIAGNOSTIC_CODES,lo as INGEST_DOCUMENT_ROOT_IDENTITY,rd as INGEST_FEATURES,Wp as INGEST_FEATURE_CAPABILITIES,is as INGEST_PLAN_VERSION,za as INGRESS_INTENTS,KH as INITIAL_ROOT_FONT_SIZE,lf as INLINE_CHILD_CONTAINER_TYPES,xb as ImageShape,dd as IngestApplicationError,Qd as KNOWN_METADATA_PREFIXES,t0 as KNOWN_STATE_KEYS,mS as LAYER_PRESENTATION_IDS,dS as LIBRARY_ASSEMBLY_KIND_ORDER,_c as LIBRARY_EMIT_ORDER,lH as LIBRARY_KINDS,cb as Lightning,ZS as Line,Af as LinearGradientBuilder,Hh as MARKER_HEIGHT,wu as MARKER_VIEWBOX,Uh as MARKER_WIDTH,nI as MATHML_EXTENSION_URI,ji as MAX_COORDINATE_PRECISION,b0 as MIGRATIONS,um as NAMESPACE_VOCABULARIES,eb as NGon,oG as NON_RENDERING_LIBRARY_KINDS,B1 as NON_WIRE_PROP_KEYS,ul as NUMERIC_SHAPE_TRANSFORM_STATE_KEYS,gb as NestedSvg,uu as NodeSchemaRegistry,hu as PAINT_SERVER_PASSTHROUGH_ATTR,Vb as PATH_DATA_TRACK_PROPERTIES,Vt as POLYGON_GEOMETRY_DEFAULTS,di as PRESENTATION_SEMANTICS,QR as PUZZLE_DEFAULTS,bb as Path,Gb as PathCurveType,_C as PathPointType,Ef as PatternBuilder,vb as Polyline,Is as RDF_NS,jh as RENDER_DIAGNOSTIC_CODES,zB as RENDER_FEATURES,FB as RENDER_FEATURE_CAPABILITIES,HE as RENDER_TARGETS,Ya as RICH_TEXT_STYLE_KEYS,Nf as RadialGradientBuilder,YS as Rectangle,rb as Ring,ud as SAXES_SVG_XML_PARSER_HOST,iF as SCRIPT_ANIMATION_GENERATORS,jb as SERIALIZED_SHAPE_STATE_KEYS,KE as SHAPE_ENVELOPE_KEYS,We as SHAPE_GEOMETRY_DEFAULTS,Ub as SHAPE_TRANSFORM_STATE_KEYS,go as SVGSKETCH_NS,NN as SVGSKETCH_PATH_EXTENSIONS,mm as SVG_CONDITIONAL_PROCESSING_ATTRIBUTES,sI as SVG_IMPORT_CAPABILITY_OWNERS,te as SVG_NAMESPACE,_L as SVG_NS,ed as SVG_PRESENTATION_PROPERTIES,MP as SVG_WELL_KNOWN_NAMESPACE_URIS,Ao as SceneGraph,ar as SceneNode,ln as ShapeBuilder,hb as ShapeReference,db as SpeechBubble,ib as Spiral,qS as Square,tb as Star,ef as SvgImportError,Ri as SvgSourceDecodingError,Ga as SvgXmlParserHostError,fb as Switch,Km as TEXT_PATH_GENERATED_ID_PREFIX,Jd as TYPED_FIELD_PREDICATES,QS as Text,Ru as TextLayoutEngine,KS as Timeline,HS as Track,JS as Triangle,bl as VARIANT_INTERPOLATION_POLICY,yb as Video,mb as View,gS as WRAPPER_PRESENTATION_IDS,tI as XHTML_EXTENSION_URI,LH as accumulateAnimationValue,FH as addAnimationValues,Ql as addSmilPointsValues,Qt as affine,Al as affineFromArray,Ct as affineToArray,XH as almostEqualAffine,kv as animationBackwardsFillTrack,xv as animationCycleDuration,Or as animationDefinitionTargetShapeId,wv as animationTrackActiveEnd,Iv as animationTrackDocumentBegin,no as appearanceLayers,Xf as appendAppearanceLayer,qe as applyAffineToPoint,op as applyAffineToVector,ZC as applyAppearanceStyle,Bi as applyClipMaskGroupDelta,BR as applyClipMaskPlanToShapes,Cv as applyCssAnimationLonghandOverrides,sf as applyGuideDeltaOp,oO as applyIngestPlan,af as applyMeasurementDeltaOp,Ej as applyMetadataDeltaOp,cS as applyOpToSnapshot,lR as applyOpsInPlace,jj as applyOpsToSnapshot,dR as applyOpsToSnapshotWithAccepted,lP as applyPathNodeValue,Pd as applyRichTextFormat,Mm as applyTextSplice,Ui as applyTextTransform,nv as applyTimingFunctionToKeyframe,Xl as arcEndpointToCenter,Dc as areTracksTimingEquivalent,Ol as around,pR as assembleLibraryDefs,UR as assembleSvgFromPlan,UE as assertIngestFeatureRegistry,Mx as assertIngestPolicyRegistry,eD as assertNamespaceVocabularyRegistry,Df as assertRasterImage,pD as assertSvgImportCapabilityOwners,xR as authoredPaintDeclarations,Hf as baseFillLayer,Kf as baseStrokeLayer,Iy as buildCompoundTransformValues,br as buildDefinitionPlacementIndex,aj as buildForeignImportReport,Ag as buildFreshMetadataBlock,Cj as buildGuideDeltaOps,Eg as buildManagedChildren,ek as buildManagedDescription,Aj as buildMeasurementDeltaOps,Nj as buildMetadataDeltaOps,Rr as buildRenderPlan,or as buildSmilKeyframeData,gr as buildSmilKeyframes,q6 as buildSvgDestinationIdentityIndex,tj as buildSvgIngestPlan,SS as buildSymbolMaterializationPlan,ky as buildViewBoxSmilKeyframeData,Bv as canonicalPolygonTransformString,ur as canonicalTransformMatrix,fn as canonicalTransformString,fj as chainHasTargetedEffects,hd as claimElementThroughVocabulary,IT as classifyIngestDiagnostic,bo as classifySvgExternalAssetUrl,dh as clipMaskDefinitionFromGroup,ui as clipMaskDefinitionsFromGroups,el as clipMaskGroupDefId,Ut as clipMaskGroupDefinitionId,lh as clipMaskGroupIsRawBacked,As as clipMaskGroupWithDefinition,wf as clipMaskOwnedDefIds,jm as cloneTextSpanTree,YT as collaborationResourceKey,Ny as collectDocumentEnvelopeLibraryReferenceIds,zy as collectFontFacesFromPlan,yG as collectFontFamiliesFromPlan,os as collectMarkerReferences,Ku as collectReferencedLibraryDefs,JE as collectReferencedMarkerIds,Cy as collectSvgFragmentLibraryReferenceIds,Zp as collectUnknownDocumentFields,eH as compareImages,gl as compareOrderKeys,$l as composeDecomposedTransformMatrix,zf as compositeOver,fp as computeArrowVertices,rx as computeCatmullRomSegments,hp as computeCloudPath,up as computeCrossVertices,Ip as computeDashArray,xp as computeFlowchartBoxPath,bp as computeGearPath,tx as computeGearVertices,gp as computeHeartPath,mp as computeLightningVertices,jl as computePolygonVertices,vp as computeRectanglePath,yp as computeRingPath,pp as computeSpeechBubbleVertices,Sp as computeSpiralPath,pr as computeSplinePath,dp as computeStarVertices,ay as connectorLabelAnchor,An as containerTransformNeedsContentPivot,fY as convertGradientUnits,pc as createDocument,Js as createSceneNode,L_ as createShape,Z6 as createSvgDestinationIdAllocator,Qh as createSvgPathMetrics,pq as createTextLayoutKey,mq as createTextLayoutProduct,ks as createViewbox,K2 as createWordSearchPrimitiveMask,Nv as cssAnimationFillField,xa as cssNamedColorToRgb,Tp as cubicBezierExtent1D,qf as cubicBezierToEasingFields,Ic as customPatternDefToLibraryDef,Lm as declaredRichTextDeltaKeys,wa as decodeCssEscapes,im as decodeSvgSourceBytes,Dl as decomposeAffine2D,_y as decoratePlanNodes,By as decorateSnapshotShapes,bk as dedupeFontFaces,aH as defaultVariableMode,Nb as deltaE2000,Y$ as deriveRichTextFormatRanges,uo as deriveSegments,G$ as deriveTextSplice,z0 as derivedConnectionPoints,QC as detachAppearanceStyle,M1 as documentObjectBounds,dx as ellipticalArcBounds,uS as emptyDocumentMetadata,nM as ensureTextSpanRange,ye as escXml,oA as evaluateEasing,W9 as evaluateFontCoverage,iv as evaluateKeyframeEasing,iA as evaluateLinearEasing,rv as evaluateParsedTimingFunction,rA as evaluateSteps,sD as evaluateSvgConditionalProcessing,hS as expandAppearanceStack,Fh as extractVariables,DL as filterAttr,Lw as filterChainExtendsBounds,kT as filterChainGroupId,Va as filterChainGroups,wg as filterDefinitionEnvelope,Kd as filterReferenceValue,Ly as finalizeRenderPlan,pf as findShapeById,jo as fingerprintCssAnimationDocumentStyles,Go as fingerprintCssAnimationInlineStyles,Uo as fingerprintCssAnimationTrack,id as fingerprintIngestSource,Ph as flattenShapeStateTree,ko as flattenStateExtra,_a as flattenUnknownDocumentFields,_v as foldSchemaV2AncestorTransformIntoMatrix,f_ as fontFaceKey,_o as forEachAppearanceLayerRef,Yf as forEachAppearanceStyleRef,QE as forEachLibraryRefInState,ZE as forEachMarkerRefInState,ld as forEachReachableShape,Qp as forEachShapeInLibraryDefs,GY as formatCssFontFamilyList,Rj as formatOperationValidationIssues,hy as formatSmilKeySpline,sn as formatSmilKeyTime,od as freezeIngestPlan,ff as freezeSiblingOrderKeys,jS as generateCode,WR as generateCodeWithDiagnostics,GS as generateCssCode,VS as generateD3Code,me as generateId,bg as generatePatternSvgContent,I2 as generatePuzzlePieces,_S as generateReactCode,E2 as generateSudokuPuzzle,LS as generateSvgCode,BS as generateVueCode,j2 as generateWordSearch,wR as geometryDefinitionId,kR as geometryState,iV as getBuiltInMarkerDefs,nH as getEasingCubicBezier,Lh as getEffectivePrecision,Xp as getIngestFeatureCapability,ad as getIngestFieldPolicy,uP as getKeyframeCubicBezier,Jw as getLicenseLabel,Qw as getLicenseUrl,Ms as getMarkerDescriptors,Vd as getPatternElements,Jo as getShapeGeometryKernel,Wi as getSmilAccumulate,Ws as getSmilAdditive,Ks as getSmilBeginValue,mi as getSmilFillMode,vy as getSmilMotionKeyPoints,by as getSmilRepeatCount,Sy as getSmilSetBeginValue,Hr as getSmilTrackDuration,Bh as getSvgCoordinateAttributePrecision,oi as getSvgPropertySemantics,E as getSvgSourceAttribute,at as getSvgSourceHref,pC as getWordSearchDirections,uY as gradientStopPoint,xs as gradientTransformAttribute,Cg as hasAnyTypedMetadataField,Ki as hasEmittableSmilSimpleDuration,ja as hasOpaqueSvgAncestor,xn as hasSvgSourceAttribute,Xy as importSvg,bT as importSvgWithDiagnostics,Vi as indexLibraryDefinitions,Vy as inferSvgCoordinatePrecision,Uf as initialOrderKeys,MS as injectClipMaskReference,Qv as inspectCssTransformValue,fv as interpolateAngle,dA as interpolateCharOffsetArray,mv as interpolateColor,DH as interpolateDasharrayLists,uA as interpolateGradient,Qf as interpolateNumericArray,EH as interpolatePathData,fA as interpolatePlainObject,cA as interpolatePointArray,OH as interpolatePolylinePoints,vA as interpolateShapeTrees,lA as interpolateSplinePointArray,Ta as invertAffine,AH as isColorValue,ry as isConnectorLineState,Il as isCssAnimationDeclarationName,dc as isCssGenericFamilyName,Zf as isCssNamedColor,yy as isDefaultKeyPoints,Lu as isDefaultKeyTimes,Fa as isDocumentImportIntent,Sk as isEntirelyUnembeddableFamilyList,xi as isFiniteAffineArray,iH as isGeometryTrackProperty,cv as isGradientLike,un as isIdentityAffine,Fu as isIdentityLinearSplines,_u as isIndefiniteSetTrack,Hs as isIndefiniteSmilSimpleDuration,vi as isNumericArray,rH as isPathDataTrackProperty,$u as isPathNodeTrack,xh as isReusablePatternTile,Mi as isSafeGradientRootAttributeName,zi as isSafePatternRootAttributeName,Bu as isSetSequenceTrack,si as isSvgPresentationProperty,HI as isTextPathGeneratedId,jg as isUnembeddableFamilyName,ml as isValidOrderKey,Sa as keyBetween,jf as keysBetween,YC as layerFilterTargets,Qb as layerPaints,PR as layerState,uV as layoutText,cd as legacyEndpointMarkerId,Ye as lerpNumber,g2 as linearGradient,xg as linearGradientEnvelope,gC as lintWordSearchOptions,my as lowerPathNodeTracks,Ab as luma709,_H as mapAnimationTrackTime,JC as matchCubicBezierToPreset,Uj as materializeSceneTreeOrderKeys,sp as matrixTransformPart,Dj as maxCollaborationTimestamp,us as mergeRichTextStyle,Tc as migrateSnapshot,p0 as migrateV11toV12,m0 as migrateV14toV15,g0 as migrateV15toV16,h0 as migrateV16toV17,y0 as migrateV17toV18,S0 as migrateV18toV19,f0 as migrateV6toV7,Pc as migrateViewboxSidecarToViews,kf as motionPathD,Wc as moveResourceById,Ie as multiplyAffine,x_ as mutateSvgClipMaskDefinitionMarkup,Qx as namespaceVocabularies,Ka as namespaceVocabulary,Sl as needsAppearanceStack,Te as nodeSchemas,rr as normalizeClipMaskGroups,Su as normalizePaintServerDef,ps as normalizeRichTextRuns,Sr as normalizeRichTextStyle,kd as normalizeRichTextStyleDelta,lE as normalizeSmilPointsValue,Jj as normalizeSnapshotStructure,rU as normalizeSnapshotToCanonicalDocument,on as orderSiblings,Wf as paintingLayers,ni as parseColor,ip as parseCssAnimationShorthand,Bo as parseCssTimingFunction,Ll as parseCssTransformOrigin,Dh as parseDocument,w0 as parseDocumentWithDiagnostics,nu as parseFontFamilyList,NH as parseInterpolationNumbers,aP as parsePathNodeProperty,Ua as parsePreserveAspectRatio,Mp as parseSmilAdditive,dr as parseSmilClockValue,zp as parseSmilDuration,vx as parseSmilFillField,ao as parseSmilKeySplines,so as parseSmilKeyTimes,bx as parseSmilRepeatSettings,es as parseSmilValues,Yn as parseSvgAbsoluteLength,ze as parseSvgLength,Ho as parseSvgLengthList,Rt as parseSvgLengthToken,Fr as parseSvgPathData,om as parseSvgRootFrame,Cn as parseSvgSourceDocument,S$ as parseSvgStyleAttribute,Rn as parseSvgTransformList,Mt as parseSvgViewBox,xF as parseSvgatorPayload,KB as parseVariableArgs,z2 as parseWordSearchWords,kh as partitionShapeStateTree,gu as partitionStateExtra,Ba as partitionUnknownDocumentFields,aA as pathCommandStructuresMatch,mr as pathDataBounds,cP as pathNodeTracksAreSuperseded,y2 as pattern,vg as patternDefinitionEnvelope,wh as patternLibraryDefToCustomPatternDef,Ih as patternTileSize,Pl as pickCssAnimationListItem,oU as plainTextOf,hR as plainTextStyle,$S as planClipMaskGroups,D_ as planSnapshotExternalEffects,$m as planSvgAnimations,km as planSvgAuthoredAttributes,og as planSvgClipMasks,gm as planSvgConditionalProcessing,dm as planSvgContainerHierarchy,Gg as planSvgDocumentExtensions,cm as planSvgEmbeddedFrames,th as planSvgExternalEffects,pg as planSvgFilters,cg as planSvgGradients,du as planSvgImport,Qm as planSvgLeafGeometry,sg as planSvgMarkers,_g as planSvgMetadata,qa as planSvgOccurrenceViewports,fg as planSvgPaintServerDefinitions,lg as planSvgPatterns,wm as planSvgResourceDependencies,yg as planSvgScripts,ym as planSvgSourceIdentifiers,Om as planSvgStyleCascade,vm as planSvgSymbolUses,bm as planSvgUseOccurrences,am as planSvgViews,xy as planTransformFusion,ES as planVariantTransitions,CS as planVariantTransitionsCss,RS as planVariantTransitionsSmil,AS as planVariantTransitionsWaapi,wy as planViewBoxFusion,Y9 as preferredSubsetsForText,Mf as premultiply,iu as prepareSvgAuthorCssForLiveProjection,Ik as prepareSvgExternalAssetUrlForLiveProjection,S_ as prepareSvgMarkupForLiveProjection,Bx as prepareSvgXmlSource,Hx as preserveAspectRatioAlignFactor,HU as projectClipMaskDefinitionAnimations,Vl as projectCssTransformStops,vf as projectDefinitionAnimations,ac as projectPresentation,Li as projectPresentationEntry,df as projectSceneTreeOntoClipMaskGroups,ra as projectSceneTreeOntoShapes,Ma as projectSvgAnimationPlan,Gp as projectSvgAnimationTimeline,ST as projectSvgImportToIngestPlan,Wy as projectSvgImportToSnapshot,lc as projectSvgSourceNodes,TF as projectSvgatorAnimation,Fs as projectTextLinePosition,Um as projectTextSpanRotations,tk as promoteManagedDescription,$j as promoteRebasedShapeUpdateClock,xf as pruneAndWrapSubtree,Rp as quadraticBezierExtent1D,h2 as radialGradient,Ig as radialGradientEnvelope,X$ as rebaseRichTextFormatRanges,Z$ as rebaseRichTextRuns,gg as recognizeScriptAnimation,zu as reflectCubicBezier,mW as registerNamespaceVocabulary,Jx as registeredExtensionUris,oE as registeredShapeGeometryTypes,yn as removeResourceById,Jy as removeResourceByKey,tS as removeResourceByName,oR as removeTrackKeyframe,Kr as renderAnimationElements,fy as renderBuiltinMarkerDefs,j0 as renderCircle,LR as renderClipMaskDefinitionAnimationElements,_R as renderClipMaskDefinitionShape,Ry as renderDefinitionAnimationElements,Dg as renderDescriptiveElements,Ty as renderDocumentAnimationElements,Ac as renderDocumentExtensionAttributes,ku as renderDocumentExtensionNodes,Pu as renderDocumentExtensions,vS as renderDocumentScripts,sa as renderDocumentStyles,U0 as renderEllipse,OL as renderFilterDefs,Hd as renderFilterElement,OP as renderFilterLibraryDef,kg as renderFilterPrimitive,Uw as renderFilterPrimitivesForType,nP as renderFlowchartBox,Z0 as renderForeignObject,LV as renderGradientDefs,Py as renderGradientStopAnimationElement,q0 as renderImage,Xs as renderLibraryDef,DP as renderLibraryDefs,K0 as renderLine,ly as renderLinearGradient,AP as renderLinearGradientLibraryDef,CP as renderMarkerLibraryDef,qU as renderPaintServerDefs,EP as renderPatternLibraryDef,Kn as renderPlanDefsBody,rP as renderPolygonShape,Y0 as renderPolyline,dy as renderRadialGradient,NP as renderRadialGradientLibraryDef,H0 as renderRectangle,sG as renderReferencedLibraryDefs,Bc as renderResolvedSymbolDefinitionForest,Ey as renderResolvedSymbolDefinitionSubtree,Ys as renderResolvedSymbolLibraryDef,kn as renderShape,gi as renderShapeContextForLibrary,X0 as renderSpline,jw as renderSvgPrimitiveChainFilter,tP as renderSymbolInstance,kP as renderSymbolLibraryDef,IS as renderTemplateVariablesStyle,W0 as renderText,Lc as renderTextSpanAnimationElements,nl as renderToSvg,Pf as renderToSvgWithDiagnostics,DS as renderVariantTransitionScript,OS as renderVariantTransitionStylesheet,uh as replaceClipMaskDefinition,jr as replaceClipMaskGroupsInSceneTree,Kj as replaySceneTreePlacements,Vh as requiredDecimalPrecision,aU as requiredSubsetsForText,Zb as resolveAppearanceStyle,sy as resolveConnectorAnchorFromDocument,iy as resolveConnectorEndpoints,gc as resolveContainerTransform,fu as resolveContainerTransformFromContentBounds,Rv as resolveCssAnimationEasingType,wo as resolveEmbeddedSvgTransform,E1 as resolveEmbeddedSvgViewportFrameBounds,Hg as resolveFontStyle,Ug as resolveFontWeight,NF as resolveGradientGeometry,CF as resolveGradientLibraryDef,vh as resolveInlineContainerTransform,Ng as resolveMetadataQName,sm as resolvePasteWrapperViewportSize,dP as resolvePathDAtTime,$w as resolvePatternLibraryDef,L1 as resolvePatternTile,K$ as resolveRichTextStyleAt,QK as resolveRootViewportFraming,Jn as resolveShapeGeometry,xc as resolveShapeLocalObjectBounds,fi as resolveShapeObjectBounds,Sh as resolveShapeReferenceTransform,iU as resolveStyledTextLines,zd as resolveSvgGradientGeometry,Mr as resolveSvgLengthToken,Sw as resolveSvgPatternTile,rm as resolveSvgQName,hx as resolveSvgRectRadii,Od as resolveSvgTextSpanTarget,ss as resolveSvgViewport,Uu as resolveSymbolDefinitionForestRootIds,Zo as resolveSymbolInstanceContent,WN as resolveSymbolInstanceShapes,bh as resolveSymbolInstanceTransform,yc as resolveSymbolViewport,Wh as resolveTextSpanProjection,LB as rewriteDocumentEmbeddedPayloads,Yu as rewriteIdReferencesInMarkup,Eh as rewriteShapeStateEmbeddedPayloads,qD as rewriteSvgResourceReferenceValue,Kh as richTextFontVariantCss,GI as richTextLineSpans,Oi as richTextRunsFromState,zm as richTextStyleDelta,Bm as richTextStyleDeltasEqual,er as richTextStylesEqual,Nc as richTextTspanAttributes,Og as rootMetadataAttrs,yu as rootPaintServerDefId,Pa as rotateAffine,Gn as roundCoord,VP as roundMarkupCoordinates,xu as roundNumberString,P0 as roundSerializedShape,eV as roundSnapshot,oy as routeConnector,Ei as runsFromSegments,Eb as sameSize,wA as sampleAnimationTrackTime,X9 as sampleTextForSubsets,Gm as sanitizeRichTextFormatRanges,rn as sanitizeXmlId,Wo as scaleAffine,$r as scanCssFunctionTokens,ii as scanCssLocalUrlTokens,Bj as senderCorrectionsForOp,Pp as serializeSvgPathData,gy as serializedPathNodeGeometry,Gr as serializedPresentationReader,Ob as severity,pU as shapeAppearanceLayers,yl as shapeAppearanceStyle,Zl as shapeLocalObjectBounds,$p as shapeLocalObjectCenter,gf as shapeNeedsAppearanceExpansion,k1 as shapeObjectBoundsInSpace,sE as shapeOutlineCapability,Cc as shouldRoundSvgCoordinateAttribute,Nl as skewXAffine,El as skewYAffine,Vu as smilKeyframeAttributes,Ur as snapshotBoundsView,sj as sniffDocumentBytes,va as solveCubicBezier,Of as solveSudoku,rM as spliceTextSpanTree,UN as splinePathBounds,qC as splitAppearanceForStyle,kl as splitCssAnimationList,Dr as splitCssTopLevel,ri as splitCssTopLevelRanges,Gc as splitTopLevelElements,$f as srgbToLab,Ff as ssimPlane,Oh as stringifyDocument,Qc as stripAnimationDeclarations,wl as stripCssAnimationInlineStyle,SR as subsetsForCodePoint,$h as substituteString,vu as substituteVariables,My as symbolDefinitionSemanticHash,Na as symbolInstanceTargetId,Av as synthesizeCssAnimationShorthand,Sf as templateVariablesCss,Cd as textPathGeneratedId,Rd as textSpanEffectiveRotations,Td as textSpanIds,UI as textSpanNodeById,tM as textSpanRangeByIds,wd as transformSplice,FN as transformSvgPathData,ft as translateAffine,zN as translateSvgPathData,vn as tryParseSvgTransformList,qu as unmatchedDecorationDiagnostics,sY as updateGradientLibraryDef,cn as upsertResourceById,Qy as upsertResourceByKey,eS as upsertResourceByName,iR as upsertTrackKeyframe,Pj as validateDocumentOperations,Zy as validateOperation,Tj as validatePresenceOperation,vo as validateSnapshot,N2 as validateSudokuPuzzle,zr as verticesToPath,In as visitShapeTree,ht as visitSnapshotShapeTrees,ba as writeAppearanceLayers};
|