modern-idoc 0.6.1 → 0.6.2

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.cjs CHANGED
@@ -632,7 +632,7 @@ function parseColorStopNodeList(colorStops) {
632
632
  color = normalizeColor(stop.value);
633
633
  break;
634
634
  case "hex":
635
- color = normalizeColor(stop.value);
635
+ color = normalizeColor(`#${stop.value}`);
636
636
  break;
637
637
  }
638
638
  switch (stop.length?.type) {
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(a,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(a=typeof globalThis<"u"?globalThis:a||self,k(a.modernIdoc={}))})(this,function(a){"use strict";function k(t){return typeof t=="string"?{src:t}:t}var Wt={grad:.9,turn:360,rad:360/(2*Math.PI)},S=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},h=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},b=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},Z=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},tt=function(t){return{r:b(t.r,0,255),g:b(t.g,0,255),b:b(t.b,0,255),a:b(t.a)}},H=function(t){return{r:h(t.r),g:h(t.g),b:h(t.b),a:h(t.a,3)}},Mt=/^#([0-9a-f]{3,8})$/i,E=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},et=function(t){var e=t.r,r=t.g,n=t.b,o=t.a,l=Math.max(e,r,n),c=l-Math.min(e,r,n),d=c?l===e?(r-n)/c:l===r?2+(n-e)/c:4+(e-r)/c:0;return{h:60*(d<0?d+6:d),s:l?c/l*100:0,v:l/255*100,a:o}},rt=function(t){var e=t.h,r=t.s,n=t.v,o=t.a;e=e/360*6,r/=100,n/=100;var l=Math.floor(e),c=n*(1-r),d=n*(1-(e-l)*r),D=n*(1-(1-e+l)*r),x=l%6;return{r:255*[n,d,c,c,D,n][x],g:255*[D,n,n,d,c,c][x],b:255*[c,c,D,n,n,d][x],a:o}},nt=function(t){return{h:Z(t.h),s:b(t.s,0,100),l:b(t.l,0,100),a:b(t.a)}},it=function(t){return{h:h(t.h),s:h(t.s),l:h(t.l),a:h(t.a,3)}},ot=function(t){return rt((r=(e=t).s,{h:e.h,s:(r*=((n=e.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:e.a}));var e,r,n},G=function(t){return{h:(e=et(t)).h,s:(o=(200-(r=e.s))*(n=e.v)/100)>0&&o<200?r*n/100/(o<=100?o:200-o)*100:0,l:o/2,a:e.a};var e,r,n,o},Rt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$t=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,at={string:[[function(t){var e=Mt.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?h(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?h(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=Pt.exec(t)||Bt.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:tt({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=Rt.exec(t)||$t.exec(t);if(!e)return null;var r,n,o=nt({h:(r=e[1],n=e[2],n===void 0&&(n="deg"),Number(r)*(Wt[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return ot(o)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,n=t.b,o=t.a,l=o===void 0?1:o;return S(e)&&S(r)&&S(n)?tt({r:Number(e),g:Number(r),b:Number(n),a:Number(l)}):null},"rgb"],[function(t){var e=t.h,r=t.s,n=t.l,o=t.a,l=o===void 0?1:o;if(!S(e)||!S(r)||!S(n))return null;var c=nt({h:Number(e),s:Number(r),l:Number(n),a:Number(l)});return ot(c)},"hsl"],[function(t){var e=t.h,r=t.s,n=t.v,o=t.a,l=o===void 0?1:o;if(!S(e)||!S(r)||!S(n))return null;var c=function(d){return{h:Z(d.h),s:b(d.s,0,100),v:b(d.v,0,100),a:b(d.a)}}({h:Number(e),s:Number(r),v:Number(n),a:Number(l)});return rt(c)},"hsv"]]},ut=function(t,e){for(var r=0;r<e.length;r++){var n=e[r][0](t);if(n)return[n,e[r][1]]}return[null,void 0]},jt=function(t){return typeof t=="string"?ut(t.trim(),at.string):typeof t=="object"&&t!==null?ut(t,at.object):[null,void 0]},W=function(t,e){var r=G(t);return{h:r.h,s:b(r.s+100*e,0,100),l:r.l,a:r.a}},M=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},lt=function(t,e){var r=G(t);return{h:r.h,s:r.s,l:b(r.l+100*e,0,100),a:r.a}},st=function(){function t(e){this.parsed=jt(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return h(M(this.rgba),2)},t.prototype.isDark=function(){return M(this.rgba)<.5},t.prototype.isLight=function(){return M(this.rgba)>=.5},t.prototype.toHex=function(){return e=H(this.rgba),r=e.r,n=e.g,o=e.b,c=(l=e.a)<1?E(h(255*l)):"","#"+E(r)+E(n)+E(o)+c;var e,r,n,o,l,c},t.prototype.toRgb=function(){return H(this.rgba)},t.prototype.toRgbString=function(){return e=H(this.rgba),r=e.r,n=e.g,o=e.b,(l=e.a)<1?"rgba("+r+", "+n+", "+o+", "+l+")":"rgb("+r+", "+n+", "+o+")";var e,r,n,o,l},t.prototype.toHsl=function(){return it(G(this.rgba))},t.prototype.toHslString=function(){return e=it(G(this.rgba)),r=e.h,n=e.s,o=e.l,(l=e.a)<1?"hsla("+r+", "+n+"%, "+o+"%, "+l+")":"hsl("+r+", "+n+"%, "+o+"%)";var e,r,n,o,l},t.prototype.toHsv=function(){return e=et(this.rgba),{h:h(e.h),s:h(e.s),v:h(e.v),a:h(e.a,3)};var e},t.prototype.invert=function(){return y({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),y(W(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),y(W(this.rgba,-e))},t.prototype.grayscale=function(){return y(W(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),y(lt(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),y(lt(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?y({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):h(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=G(this.rgba);return typeof e=="number"?y({h:e,s:r.s,l:r.l,a:r.a}):h(r.h)},t.prototype.isEqual=function(e){return this.toHex()===y(e).toHex()},t}(),y=function(t){return t instanceof st?t:new st(t)};function f(t){return t==null||t==="none"}function C(t,e=0,r=10**e){return Math.round(r*t)/r+0}function w(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(n=>w(n,e)):t;const r={};for(const n in t){const o=t[n];o!=null&&(e?r[n]=w(o,e):r[n]=o)}return r}function R(t){let e;return typeof t=="number"?e={r:t>>24&255,g:t>>16&255,b:t>>8&255,a:(t&255)/255}:e=t,y(e)}function Kt(t){return{r:C(t.r),g:C(t.g),b:C(t.b),a:C(t.a,3)}}function V(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const I="#000000FF";function ct(t){return R(t).isValid()}function v(t,e=!1){const r=R(t);if(!r.isValid()){if(typeof t=="string")return t;const d=`Failed to normalizeColor ${t}`;if(e)throw new Error(d);return console.warn(d),I}const{r:n,g:o,b:l,a:c}=Kt(r.rgba);return`#${V(n)}${V(o)}${V(l)}${V(C(c*255))}`}var O=O||{};O.parse=function(){const t={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function r(i){const u=new Error(`${e}: ${i}`);throw u.source=e,u}function n(){const i=o();return e.length>0&&r("Invalid input not EOF"),i}function o(){return A(l)}function l(){return c("linear-gradient",t.linearGradient,D)||c("repeating-linear-gradient",t.repeatingLinearGradient,D)||c("radial-gradient",t.radialGradient,At)||c("repeating-radial-gradient",t.repeatingRadialGradient,At)}function c(i,u,s){return d(u,m=>{const z=s();return z&&(g(t.comma)||r("Missing comma before color stops")),{type:i,orientation:z,colorStops:A(re)}})}function d(i,u){const s=g(i);if(s){g(t.startCall)||r("Missing (");const m=u(s);return g(t.endCall)||r("Missing )"),m}}function D(){const i=x();if(i)return i;const u=p("position-keyword",t.positionKeywords,1);return u?{type:"directional",value:u.value}:Qt()}function x(){return p("directional",t.sideOrCorner,1)}function Qt(){return p("angular",t.angleValue,1)||p("angular",t.radianValue,1)}function At(){let i,u=Ft(),s;return u&&(i=[],i.push(u),s=e,g(t.comma)&&(u=Ft(),u?i.push(u):e=s)),i}function Ft(){let i=Zt()||te();if(i)i.at=q();else{const u=U();if(u){i=u;const s=q();s&&(i.at=s)}else{const s=q();if(s)i={type:"default-radial",at:s};else{const m=J();m&&(i={type:"default-radial",at:m})}}}return i}function Zt(){const i=p("shape",/^(circle)/i,0);return i&&(i.style=Ht()||U()),i}function te(){const i=p("shape",/^(ellipse)/i,0);return i&&(i.style=J()||F()||U()),i}function U(){return p("extent-keyword",t.extentKeywords,1)}function q(){if(p("position",/^at/,0)){const i=J();return i||r("Missing positioning value"),i}}function J(){const i=ee();if(i.x||i.y)return{type:"position",value:i}}function ee(){return{x:F(),y:F()}}function A(i){let u=i();const s=[];if(u)for(s.push(u);g(t.comma);)u=i(),u?s.push(u):r("One extra comma");return s}function re(){const i=ne();return i||r("Expected color definition"),i.length=F(),i}function ne(){return oe()||ce()||se()||ue()||ae()||le()||ie()}function ie(){return p("literal",t.literalColor,0)}function oe(){return p("hex",t.hexColor,1)}function ae(){return d(t.rgbColor,()=>({type:"rgb",value:A(L)}))}function ue(){return d(t.rgbaColor,()=>({type:"rgba",value:A(L)}))}function le(){return d(t.varColor,()=>({type:"var",value:fe()}))}function se(){return d(t.hslColor,()=>{g(t.percentageValue)&&r("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const u=L();g(t.comma);let s=g(t.percentageValue);const m=s?s[1]:null;g(t.comma),s=g(t.percentageValue);const z=s?s[1]:null;return(!m||!z)&&r("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[u,m,z]}})}function ce(){return d(t.hslaColor,()=>{const i=L();g(t.comma);let u=g(t.percentageValue);const s=u?u[1]:null;g(t.comma),u=g(t.percentageValue);const m=u?u[1]:null;g(t.comma);const z=L();return(!s||!m)&&r("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[i,s,m,z]}})}function fe(){return g(t.variableName)[1]}function L(){return g(t.number)[1]}function F(){return p("%",t.percentageValue,1)||de()||ge()||Ht()}function de(){return p("position-keyword",t.positionKeywords,1)}function ge(){return d(t.calcValue,()=>{let i=1,u=0;for(;i>0&&u<e.length;){const m=e.charAt(u);m==="("?i++:m===")"&&i--,u++}i>0&&r("Missing closing parenthesis in calc() expression");const s=e.substring(0,u-1);return Q(u-1),{type:"calc",value:s}})}function Ht(){return p("px",t.pixelValue,1)||p("em",t.emValue,1)}function p(i,u,s){const m=g(u);if(m)return{type:i,value:m[s]}}function g(i){let u,s;return s=/^\s+/.exec(e),s&&Q(s[0].length),u=i.exec(e),u&&Q(u[0].length),u}function Q(i){e=e.substr(i)}return function(i){return e=i.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),n()}}();const ft=O.parse.bind(O);var T=T||{};T.stringify=function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var r=t.visit(e.orientation);return r&&(r+=", "),e.type+"("+r+t.visit(e.colorStops)+")"},visit_shape:function(e){var r=e.value,n=t.visit(e.at),o=t.visit(e.style);return o&&(r+=" "+o),n&&(r+=" at "+n),r},"visit_default-radial":function(e){var r="",n=t.visit(e.at);return n&&(r+=n),r},"visit_extent-keyword":function(e){var r=e.value,n=t.visit(e.at);return n&&(r+=" at "+n),r},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return t.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return t.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return t.visit_color("var("+e.value+")",e)},visit_color:function(e,r){var n=e,o=t.visit(r.length);return o&&(n+=" "+o),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var r="",n=e.length;return e.forEach(function(o,l){r+=t.visit(o),l<n-1&&(r+=", ")}),r},visit_object:function(e){return e.width&&e.height?t.visit(e.width)+" "+t.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e);if(typeof e=="object"&&!e.type)return t.visit_object(e);if(e.type){var r=t["visit_"+e.type];if(r)return r(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}}();const Xt=T.stringify.bind(T);function dt(t){const e=t.length-1;return t.map((r,n)=>{var d;const o=r.value;let l=C(n/e,3),c="#00000000";switch(r.type){case"rgb":c=v({r:Number(o[0]??0),g:Number(o[1]??0),b:Number(o[2]??0)});break;case"rgba":c=v({r:Number(o[0]??0),g:Number(o[1]??0),b:Number(o[2]??0),a:Number(o[3]??0)});break;case"literal":c=v(r.value);break;case"hex":c=v(r.value);break}switch((d=r.length)==null?void 0:d.type){case"%":l=Number(r.length.value)/100;break}return{offset:l,color:c}})}function gt(t){var r;let e=0;switch((r=t.orientation)==null?void 0:r.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:dt(t.colorStops)}}function ht(t){var e;return(e=t.orientation)==null||e.map(r=>{switch(r==null?void 0:r.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:dt(t.colorStops)}}function $(t){return t.startsWith("linear-gradient")||t.startsWith("radial-gradient")}function vt(t){return ft(t).map(e=>{switch(e==null?void 0:e.type){case"linear-gradient":return gt(e);case"repeating-linear-gradient":return{...gt(e),repeat:!0};case"radial-gradient":return ht(e);case"repeating-radial-gradient":return{...ht(e),repeat:!0};default:return}}).filter(Boolean)}function P(t){let e;return typeof t=="string"?e={color:t}:e=t,{color:v(e.color)}}function B(t){let e;typeof t=="string"?e={image:t}:e=t;const r=vt(e.image)[0];switch(r==null?void 0:r.type){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}return{}}function Yt(t){return t}function mt(t){let e;return typeof t=="string"?e={preset:t}:e=t,{preset:e.preset,foregroundColor:f(e.foregroundColor)?void 0:v(e.foregroundColor),backgroundColor:f(e.backgroundColor)?void 0:v(e.backgroundColor)}}function _(t){if(typeof t=="string")return ct(t)?P({color:t}):$(t)?B({image:t}):{image:t};if(f(t.color))if(f(t.image)){if(f(t.preset))return mt(t)}else return $(t.image)?B(t):t;else return P(t);throw new Error("Unknown fill property object")}function pt(t){return typeof t=="string"?{..._(t),fillWithShape:!1}:{..._(t),fillWithShape:!!t.fillWithShape}}function j(){return{color:I,offsetX:0,offsetY:0,blurRadius:1}}function K(t){return{...j(),...w({...t,color:f(t.color)?I:v(t.color)})}}function bt(){return{...j(),scaleX:1,scaleY:1}}function yt(t){return{...bt(),...K(t)}}function Ut(t){return t}function St(t){return w({...t,softEdge:f(t.softEdge)?void 0:t.softEdge,outerShadow:f(t.outerShadow)?void 0:yt(t.outerShadow),innerShadow:f(t.innerShadow)?void 0:K(t.innerShadow)})}function Ct(t){return typeof t=="string"?{..._(t),fillWithShape:!1}:{..._(t),fillWithShape:!!t.fillWithShape}}function wt(t){return typeof t=="string"?{color:v(t)}:{...t,color:f(t.color)?void 0:v(t.color)}}function zt(t){return typeof t=="string"?{color:v(t)}:{...t,color:f(t.color)?I:v(t.color)}}function kt(){return{boxShadow:"none"}}function _t(t){return typeof t=="string"?{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function Nt(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function Dt(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function Gt(){return{...Nt(),...Dt(),...kt(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function It(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function xt(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function Lt(){return{...It(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function Et(){return{...xt(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Vt(){return{...Et(),...Lt(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function N(t){return w({...t,color:f(t.color)?void 0:v(t.color),backgroundColor:f(t.backgroundColor)?void 0:v(t.backgroundColor),borderColor:f(t.borderColor)?void 0:v(t.borderColor),outlineColor:f(t.outlineColor)?void 0:v(t.outlineColor),shadowColor:f(t.shadowColor)?void 0:v(t.shadowColor)})}function qt(){return{...Gt(),...Vt()}}function X(t=""){return(Array.isArray(t)?t:[t]).map(r=>typeof r=="string"?{fragments:[{content:r}]}:"content"in r?{fragments:[N(r)]}:"fragments"in r?{...N(r),fragments:r.fragments.map(n=>N(n))}:Array.isArray(r)?{fragments:r.map(n=>typeof n=="string"?{content:n}:N(n))}:{fragments:[]})}function Ot(t){return typeof t=="string"?{content:[{fragments:[{content:t}]}]}:"content"in t?{...t,content:X(t.content)}:{content:X(t)}}function Tt(t){return typeof t=="string"?{src:t}:t}function Y(t){var e;return w({...t,style:f(t.style)?void 0:N(t.style),text:f(t.text)?void 0:Ot(t.text),background:f(t.background)?void 0:pt(t.background),shape:f(t.shape)?void 0:_t(t.shape),fill:f(t.fill)?void 0:_(t.fill),outline:f(t.outline)?void 0:wt(t.outline),foreground:f(t.foreground)?void 0:Ct(t.foreground),shadow:f(t.shadow)?void 0:zt(t.shadow),video:f(t.video)?void 0:Tt(t.video),audio:f(t.audio)?void 0:k(t.audio),effect:f(t.effect)?void 0:St(t.effect),children:(e=t.children)==null?void 0:e.map(r=>Y(r))})}function Jt(t){return Y(t)}a.clearUndef=w,a.defaultColor=I,a.getDefaultElementStyle=Gt,a.getDefaultHighlightStyle=It,a.getDefaultInnerShadow=j,a.getDefaultLayoutStyle=Nt,a.getDefaultListStyleStyle=xt,a.getDefaultOuterShadow=bt,a.getDefaultShadowStyle=kt,a.getDefaultStyle=qt,a.getDefaultTextInlineStyle=Lt,a.getDefaultTextLineStyle=Et,a.getDefaultTextStyle=Vt,a.getDefaultTransformStyle=Dt,a.isColor=ct,a.isGradient=$,a.isNone=f,a.normalizeAudio=k,a.normalizeBackground=pt,a.normalizeColor=v,a.normalizeColorFill=P,a.normalizeDocument=Jt,a.normalizeEffect=St,a.normalizeElement=Y,a.normalizeFill=_,a.normalizeForeground=Ct,a.normalizeGradient=vt,a.normalizeGradientFill=B,a.normalizeImageFill=Yt,a.normalizeInnerShadow=K,a.normalizeOuterShadow=yt,a.normalizeOutline=wt,a.normalizePresetFill=mt,a.normalizeShadow=zt,a.normalizeShape=_t,a.normalizeSoftEdge=Ut,a.normalizeStyle=N,a.normalizeText=Ot,a.normalizeTextContent=X,a.normalizeVideo=Tt,a.parseColor=R,a.parseGradient=ft,a.round=C,a.stringifyGradient=Xt,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
1
+ (function(a,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(a=typeof globalThis<"u"?globalThis:a||self,k(a.modernIdoc={}))})(this,function(a){"use strict";function k(t){return typeof t=="string"?{src:t}:t}var Wt={grad:.9,turn:360,rad:360/(2*Math.PI)},S=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},h=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},b=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},Z=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},tt=function(t){return{r:b(t.r,0,255),g:b(t.g,0,255),b:b(t.b,0,255),a:b(t.a)}},H=function(t){return{r:h(t.r),g:h(t.g),b:h(t.b),a:h(t.a,3)}},Mt=/^#([0-9a-f]{3,8})$/i,E=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},et=function(t){var e=t.r,r=t.g,n=t.b,o=t.a,l=Math.max(e,r,n),c=l-Math.min(e,r,n),d=c?l===e?(r-n)/c:l===r?2+(n-e)/c:4+(e-r)/c:0;return{h:60*(d<0?d+6:d),s:l?c/l*100:0,v:l/255*100,a:o}},rt=function(t){var e=t.h,r=t.s,n=t.v,o=t.a;e=e/360*6,r/=100,n/=100;var l=Math.floor(e),c=n*(1-r),d=n*(1-(e-l)*r),D=n*(1-(1-e+l)*r),x=l%6;return{r:255*[n,d,c,c,D,n][x],g:255*[D,n,n,d,c,c][x],b:255*[c,c,D,n,n,d][x],a:o}},nt=function(t){return{h:Z(t.h),s:b(t.s,0,100),l:b(t.l,0,100),a:b(t.a)}},it=function(t){return{h:h(t.h),s:h(t.s),l:h(t.l),a:h(t.a,3)}},ot=function(t){return rt((r=(e=t).s,{h:e.h,s:(r*=((n=e.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:e.a}));var e,r,n},G=function(t){return{h:(e=et(t)).h,s:(o=(200-(r=e.s))*(n=e.v)/100)>0&&o<200?r*n/100/(o<=100?o:200-o)*100:0,l:o/2,a:e.a};var e,r,n,o},Rt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$t=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,at={string:[[function(t){var e=Mt.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?h(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?h(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=Pt.exec(t)||Bt.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:tt({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=Rt.exec(t)||$t.exec(t);if(!e)return null;var r,n,o=nt({h:(r=e[1],n=e[2],n===void 0&&(n="deg"),Number(r)*(Wt[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return ot(o)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,n=t.b,o=t.a,l=o===void 0?1:o;return S(e)&&S(r)&&S(n)?tt({r:Number(e),g:Number(r),b:Number(n),a:Number(l)}):null},"rgb"],[function(t){var e=t.h,r=t.s,n=t.l,o=t.a,l=o===void 0?1:o;if(!S(e)||!S(r)||!S(n))return null;var c=nt({h:Number(e),s:Number(r),l:Number(n),a:Number(l)});return ot(c)},"hsl"],[function(t){var e=t.h,r=t.s,n=t.v,o=t.a,l=o===void 0?1:o;if(!S(e)||!S(r)||!S(n))return null;var c=function(d){return{h:Z(d.h),s:b(d.s,0,100),v:b(d.v,0,100),a:b(d.a)}}({h:Number(e),s:Number(r),v:Number(n),a:Number(l)});return rt(c)},"hsv"]]},ut=function(t,e){for(var r=0;r<e.length;r++){var n=e[r][0](t);if(n)return[n,e[r][1]]}return[null,void 0]},jt=function(t){return typeof t=="string"?ut(t.trim(),at.string):typeof t=="object"&&t!==null?ut(t,at.object):[null,void 0]},W=function(t,e){var r=G(t);return{h:r.h,s:b(r.s+100*e,0,100),l:r.l,a:r.a}},M=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},lt=function(t,e){var r=G(t);return{h:r.h,s:r.s,l:b(r.l+100*e,0,100),a:r.a}},st=function(){function t(e){this.parsed=jt(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return h(M(this.rgba),2)},t.prototype.isDark=function(){return M(this.rgba)<.5},t.prototype.isLight=function(){return M(this.rgba)>=.5},t.prototype.toHex=function(){return e=H(this.rgba),r=e.r,n=e.g,o=e.b,c=(l=e.a)<1?E(h(255*l)):"","#"+E(r)+E(n)+E(o)+c;var e,r,n,o,l,c},t.prototype.toRgb=function(){return H(this.rgba)},t.prototype.toRgbString=function(){return e=H(this.rgba),r=e.r,n=e.g,o=e.b,(l=e.a)<1?"rgba("+r+", "+n+", "+o+", "+l+")":"rgb("+r+", "+n+", "+o+")";var e,r,n,o,l},t.prototype.toHsl=function(){return it(G(this.rgba))},t.prototype.toHslString=function(){return e=it(G(this.rgba)),r=e.h,n=e.s,o=e.l,(l=e.a)<1?"hsla("+r+", "+n+"%, "+o+"%, "+l+")":"hsl("+r+", "+n+"%, "+o+"%)";var e,r,n,o,l},t.prototype.toHsv=function(){return e=et(this.rgba),{h:h(e.h),s:h(e.s),v:h(e.v),a:h(e.a,3)};var e},t.prototype.invert=function(){return y({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),y(W(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),y(W(this.rgba,-e))},t.prototype.grayscale=function(){return y(W(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),y(lt(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),y(lt(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?y({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):h(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=G(this.rgba);return typeof e=="number"?y({h:e,s:r.s,l:r.l,a:r.a}):h(r.h)},t.prototype.isEqual=function(e){return this.toHex()===y(e).toHex()},t}(),y=function(t){return t instanceof st?t:new st(t)};function f(t){return t==null||t==="none"}function C(t,e=0,r=10**e){return Math.round(r*t)/r+0}function w(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(n=>w(n,e)):t;const r={};for(const n in t){const o=t[n];o!=null&&(e?r[n]=w(o,e):r[n]=o)}return r}function R(t){let e;return typeof t=="number"?e={r:t>>24&255,g:t>>16&255,b:t>>8&255,a:(t&255)/255}:e=t,y(e)}function Kt(t){return{r:C(t.r),g:C(t.g),b:C(t.b),a:C(t.a,3)}}function V(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const I="#000000FF";function ct(t){return R(t).isValid()}function v(t,e=!1){const r=R(t);if(!r.isValid()){if(typeof t=="string")return t;const d=`Failed to normalizeColor ${t}`;if(e)throw new Error(d);return console.warn(d),I}const{r:n,g:o,b:l,a:c}=Kt(r.rgba);return`#${V(n)}${V(o)}${V(l)}${V(C(c*255))}`}var O=O||{};O.parse=function(){const t={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function r(i){const u=new Error(`${e}: ${i}`);throw u.source=e,u}function n(){const i=o();return e.length>0&&r("Invalid input not EOF"),i}function o(){return A(l)}function l(){return c("linear-gradient",t.linearGradient,D)||c("repeating-linear-gradient",t.repeatingLinearGradient,D)||c("radial-gradient",t.radialGradient,At)||c("repeating-radial-gradient",t.repeatingRadialGradient,At)}function c(i,u,s){return d(u,m=>{const z=s();return z&&(g(t.comma)||r("Missing comma before color stops")),{type:i,orientation:z,colorStops:A(re)}})}function d(i,u){const s=g(i);if(s){g(t.startCall)||r("Missing (");const m=u(s);return g(t.endCall)||r("Missing )"),m}}function D(){const i=x();if(i)return i;const u=p("position-keyword",t.positionKeywords,1);return u?{type:"directional",value:u.value}:Qt()}function x(){return p("directional",t.sideOrCorner,1)}function Qt(){return p("angular",t.angleValue,1)||p("angular",t.radianValue,1)}function At(){let i,u=Ft(),s;return u&&(i=[],i.push(u),s=e,g(t.comma)&&(u=Ft(),u?i.push(u):e=s)),i}function Ft(){let i=Zt()||te();if(i)i.at=q();else{const u=U();if(u){i=u;const s=q();s&&(i.at=s)}else{const s=q();if(s)i={type:"default-radial",at:s};else{const m=J();m&&(i={type:"default-radial",at:m})}}}return i}function Zt(){const i=p("shape",/^(circle)/i,0);return i&&(i.style=Ht()||U()),i}function te(){const i=p("shape",/^(ellipse)/i,0);return i&&(i.style=J()||F()||U()),i}function U(){return p("extent-keyword",t.extentKeywords,1)}function q(){if(p("position",/^at/,0)){const i=J();return i||r("Missing positioning value"),i}}function J(){const i=ee();if(i.x||i.y)return{type:"position",value:i}}function ee(){return{x:F(),y:F()}}function A(i){let u=i();const s=[];if(u)for(s.push(u);g(t.comma);)u=i(),u?s.push(u):r("One extra comma");return s}function re(){const i=ne();return i||r("Expected color definition"),i.length=F(),i}function ne(){return oe()||ce()||se()||ue()||ae()||le()||ie()}function ie(){return p("literal",t.literalColor,0)}function oe(){return p("hex",t.hexColor,1)}function ae(){return d(t.rgbColor,()=>({type:"rgb",value:A(L)}))}function ue(){return d(t.rgbaColor,()=>({type:"rgba",value:A(L)}))}function le(){return d(t.varColor,()=>({type:"var",value:fe()}))}function se(){return d(t.hslColor,()=>{g(t.percentageValue)&&r("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const u=L();g(t.comma);let s=g(t.percentageValue);const m=s?s[1]:null;g(t.comma),s=g(t.percentageValue);const z=s?s[1]:null;return(!m||!z)&&r("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[u,m,z]}})}function ce(){return d(t.hslaColor,()=>{const i=L();g(t.comma);let u=g(t.percentageValue);const s=u?u[1]:null;g(t.comma),u=g(t.percentageValue);const m=u?u[1]:null;g(t.comma);const z=L();return(!s||!m)&&r("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[i,s,m,z]}})}function fe(){return g(t.variableName)[1]}function L(){return g(t.number)[1]}function F(){return p("%",t.percentageValue,1)||de()||ge()||Ht()}function de(){return p("position-keyword",t.positionKeywords,1)}function ge(){return d(t.calcValue,()=>{let i=1,u=0;for(;i>0&&u<e.length;){const m=e.charAt(u);m==="("?i++:m===")"&&i--,u++}i>0&&r("Missing closing parenthesis in calc() expression");const s=e.substring(0,u-1);return Q(u-1),{type:"calc",value:s}})}function Ht(){return p("px",t.pixelValue,1)||p("em",t.emValue,1)}function p(i,u,s){const m=g(u);if(m)return{type:i,value:m[s]}}function g(i){let u,s;return s=/^\s+/.exec(e),s&&Q(s[0].length),u=i.exec(e),u&&Q(u[0].length),u}function Q(i){e=e.substr(i)}return function(i){return e=i.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),n()}}();const ft=O.parse.bind(O);var T=T||{};T.stringify=function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var r=t.visit(e.orientation);return r&&(r+=", "),e.type+"("+r+t.visit(e.colorStops)+")"},visit_shape:function(e){var r=e.value,n=t.visit(e.at),o=t.visit(e.style);return o&&(r+=" "+o),n&&(r+=" at "+n),r},"visit_default-radial":function(e){var r="",n=t.visit(e.at);return n&&(r+=n),r},"visit_extent-keyword":function(e){var r=e.value,n=t.visit(e.at);return n&&(r+=" at "+n),r},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return t.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return t.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return t.visit_color("var("+e.value+")",e)},visit_color:function(e,r){var n=e,o=t.visit(r.length);return o&&(n+=" "+o),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var r="",n=e.length;return e.forEach(function(o,l){r+=t.visit(o),l<n-1&&(r+=", ")}),r},visit_object:function(e){return e.width&&e.height?t.visit(e.width)+" "+t.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e);if(typeof e=="object"&&!e.type)return t.visit_object(e);if(e.type){var r=t["visit_"+e.type];if(r)return r(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}}();const Xt=T.stringify.bind(T);function dt(t){const e=t.length-1;return t.map((r,n)=>{var d;const o=r.value;let l=C(n/e,3),c="#00000000";switch(r.type){case"rgb":c=v({r:Number(o[0]??0),g:Number(o[1]??0),b:Number(o[2]??0)});break;case"rgba":c=v({r:Number(o[0]??0),g:Number(o[1]??0),b:Number(o[2]??0),a:Number(o[3]??0)});break;case"literal":c=v(r.value);break;case"hex":c=v(`#${r.value}`);break}switch((d=r.length)==null?void 0:d.type){case"%":l=Number(r.length.value)/100;break}return{offset:l,color:c}})}function gt(t){var r;let e=0;switch((r=t.orientation)==null?void 0:r.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:dt(t.colorStops)}}function ht(t){var e;return(e=t.orientation)==null||e.map(r=>{switch(r==null?void 0:r.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:dt(t.colorStops)}}function $(t){return t.startsWith("linear-gradient")||t.startsWith("radial-gradient")}function vt(t){return ft(t).map(e=>{switch(e==null?void 0:e.type){case"linear-gradient":return gt(e);case"repeating-linear-gradient":return{...gt(e),repeat:!0};case"radial-gradient":return ht(e);case"repeating-radial-gradient":return{...ht(e),repeat:!0};default:return}}).filter(Boolean)}function P(t){let e;return typeof t=="string"?e={color:t}:e=t,{color:v(e.color)}}function B(t){let e;typeof t=="string"?e={image:t}:e=t;const r=vt(e.image)[0];switch(r==null?void 0:r.type){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}return{}}function Yt(t){return t}function mt(t){let e;return typeof t=="string"?e={preset:t}:e=t,{preset:e.preset,foregroundColor:f(e.foregroundColor)?void 0:v(e.foregroundColor),backgroundColor:f(e.backgroundColor)?void 0:v(e.backgroundColor)}}function _(t){if(typeof t=="string")return ct(t)?P({color:t}):$(t)?B({image:t}):{image:t};if(f(t.color))if(f(t.image)){if(f(t.preset))return mt(t)}else return $(t.image)?B(t):t;else return P(t);throw new Error("Unknown fill property object")}function pt(t){return typeof t=="string"?{..._(t),fillWithShape:!1}:{..._(t),fillWithShape:!!t.fillWithShape}}function j(){return{color:I,offsetX:0,offsetY:0,blurRadius:1}}function K(t){return{...j(),...w({...t,color:f(t.color)?I:v(t.color)})}}function bt(){return{...j(),scaleX:1,scaleY:1}}function yt(t){return{...bt(),...K(t)}}function Ut(t){return t}function St(t){return w({...t,softEdge:f(t.softEdge)?void 0:t.softEdge,outerShadow:f(t.outerShadow)?void 0:yt(t.outerShadow),innerShadow:f(t.innerShadow)?void 0:K(t.innerShadow)})}function Ct(t){return typeof t=="string"?{..._(t),fillWithShape:!1}:{..._(t),fillWithShape:!!t.fillWithShape}}function wt(t){return typeof t=="string"?{color:v(t)}:{...t,color:f(t.color)?void 0:v(t.color)}}function zt(t){return typeof t=="string"?{color:v(t)}:{...t,color:f(t.color)?I:v(t.color)}}function kt(){return{boxShadow:"none"}}function _t(t){return typeof t=="string"?{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function Nt(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function Dt(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function Gt(){return{...Nt(),...Dt(),...kt(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function It(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function xt(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function Lt(){return{...It(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function Et(){return{...xt(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Vt(){return{...Et(),...Lt(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function N(t){return w({...t,color:f(t.color)?void 0:v(t.color),backgroundColor:f(t.backgroundColor)?void 0:v(t.backgroundColor),borderColor:f(t.borderColor)?void 0:v(t.borderColor),outlineColor:f(t.outlineColor)?void 0:v(t.outlineColor),shadowColor:f(t.shadowColor)?void 0:v(t.shadowColor)})}function qt(){return{...Gt(),...Vt()}}function X(t=""){return(Array.isArray(t)?t:[t]).map(r=>typeof r=="string"?{fragments:[{content:r}]}:"content"in r?{fragments:[N(r)]}:"fragments"in r?{...N(r),fragments:r.fragments.map(n=>N(n))}:Array.isArray(r)?{fragments:r.map(n=>typeof n=="string"?{content:n}:N(n))}:{fragments:[]})}function Ot(t){return typeof t=="string"?{content:[{fragments:[{content:t}]}]}:"content"in t?{...t,content:X(t.content)}:{content:X(t)}}function Tt(t){return typeof t=="string"?{src:t}:t}function Y(t){var e;return w({...t,style:f(t.style)?void 0:N(t.style),text:f(t.text)?void 0:Ot(t.text),background:f(t.background)?void 0:pt(t.background),shape:f(t.shape)?void 0:_t(t.shape),fill:f(t.fill)?void 0:_(t.fill),outline:f(t.outline)?void 0:wt(t.outline),foreground:f(t.foreground)?void 0:Ct(t.foreground),shadow:f(t.shadow)?void 0:zt(t.shadow),video:f(t.video)?void 0:Tt(t.video),audio:f(t.audio)?void 0:k(t.audio),effect:f(t.effect)?void 0:St(t.effect),children:(e=t.children)==null?void 0:e.map(r=>Y(r))})}function Jt(t){return Y(t)}a.clearUndef=w,a.defaultColor=I,a.getDefaultElementStyle=Gt,a.getDefaultHighlightStyle=It,a.getDefaultInnerShadow=j,a.getDefaultLayoutStyle=Nt,a.getDefaultListStyleStyle=xt,a.getDefaultOuterShadow=bt,a.getDefaultShadowStyle=kt,a.getDefaultStyle=qt,a.getDefaultTextInlineStyle=Lt,a.getDefaultTextLineStyle=Et,a.getDefaultTextStyle=Vt,a.getDefaultTransformStyle=Dt,a.isColor=ct,a.isGradient=$,a.isNone=f,a.normalizeAudio=k,a.normalizeBackground=pt,a.normalizeColor=v,a.normalizeColorFill=P,a.normalizeDocument=Jt,a.normalizeEffect=St,a.normalizeElement=Y,a.normalizeFill=_,a.normalizeForeground=Ct,a.normalizeGradient=vt,a.normalizeGradientFill=B,a.normalizeImageFill=Yt,a.normalizeInnerShadow=K,a.normalizeOuterShadow=yt,a.normalizeOutline=wt,a.normalizePresetFill=mt,a.normalizeShadow=zt,a.normalizeShape=_t,a.normalizeSoftEdge=Ut,a.normalizeStyle=N,a.normalizeText=Ot,a.normalizeTextContent=X,a.normalizeVideo=Tt,a.parseColor=R,a.parseGradient=ft,a.round=C,a.stringifyGradient=Xt,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -630,7 +630,7 @@ function parseColorStopNodeList(colorStops) {
630
630
  color = normalizeColor(stop.value);
631
631
  break;
632
632
  case "hex":
633
- color = normalizeColor(stop.value);
633
+ color = normalizeColor(`#${stop.value}`);
634
634
  break;
635
635
  }
636
636
  switch (stop.length?.type) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-idoc",
3
3
  "type": "module",
4
- "version": "0.6.1",
4
+ "version": "0.6.2",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "Intermediate document for modern codec libs",
7
7
  "author": "wxm",