modern-idoc 0.7.7 → 0.7.8
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 +1 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(o,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(o=typeof globalThis<"u"?globalThis:o||self,k(o.modernIdoc={}))})(this,function(o){"use strict";function k(t){return typeof t=="string"?{src:t}:t}var de={grad:.9,turn:360,rad:360/(2*Math.PI)},F=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},v=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},_=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},lt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},st=function(t){return{r:_(t.r,0,255),g:_(t.g,0,255),b:_(t.b,0,255),a:_(t.a)}},U=function(t){return{r:v(t.r),g:v(t.g),b:v(t.b),a:v(t.a,3)}},ge=/^#([0-9a-f]{3,8})$/i,T=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},ct=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,u=Math.max(e,n,r),s=u-Math.min(e,n,r),c=s?u===e?(n-r)/s:u===n?2+(r-e)/s:4+(e-n)/s:0;return{h:60*(c<0?c+6:c),s:u?s/u*100:0,v:u/255*100,a:i}},ft=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var u=Math.floor(e),s=r*(1-n),c=r*(1-(e-u)*n),g=r*(1-(1-e+u)*n),m=u%6;return{r:255*[r,c,s,s,g,r][m],g:255*[g,r,r,c,s,s][m],b:255*[s,s,g,r,r,c][m],a:i}},dt=function(t){return{h:lt(t.h),s:_(t.s,0,100),l:_(t.l,0,100),a:_(t.a)}},gt=function(t){return{h:v(t.h),s:v(t.s),l:v(t.l),a:v(t.a,3)}},ht=function(t){return ft((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},G=function(t){return{h:(e=ct(t)).h,s:(i=(200-(n=e.s))*(r=e.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,n,r,i},he=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ve=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,me=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pe=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vt={string:[[function(t){var e=ge.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?v(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?v(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=me.exec(t)||pe.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:st({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=he.exec(t)||ve.exec(t);if(!e)return null;var n,r,i=dt({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(de[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return ht(i)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,i=t.a,u=i===void 0?1:i;return F(e)&&F(n)&&F(r)?st({r:Number(e),g:Number(n),b:Number(r),a:Number(u)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,i=t.a,u=i===void 0?1:i;if(!F(e)||!F(n)||!F(r))return null;var s=dt({h:Number(e),s:Number(n),l:Number(r),a:Number(u)});return ht(s)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,i=t.a,u=i===void 0?1:i;if(!F(e)||!F(n)||!F(r))return null;var s=function(c){return{h:lt(c.h),s:_(c.s,0,100),v:_(c.v,0,100),a:_(c.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(u)});return ft(s)},"hsv"]]},mt=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][1]]}return[null,void 0]},ye=function(t){return typeof t=="string"?mt(t.trim(),vt.string):typeof t=="object"&&t!==null?mt(t,vt.object):[null,void 0]},X=function(t,e){var n=G(t);return{h:n.h,s:_(n.s+100*e,0,100),l:n.l,a:n.a}},Y=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},pt=function(t,e){var n=G(t);return{h:n.h,s:n.s,l:_(n.l+100*e,0,100),a:n.a}},yt=function(){function t(e){this.parsed=ye(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 v(Y(this.rgba),2)},t.prototype.isDark=function(){return Y(this.rgba)<.5},t.prototype.isLight=function(){return Y(this.rgba)>=.5},t.prototype.toHex=function(){return e=U(this.rgba),n=e.r,r=e.g,i=e.b,s=(u=e.a)<1?T(v(255*u)):"","#"+T(n)+T(r)+T(i)+s;var e,n,r,i,u,s},t.prototype.toRgb=function(){return U(this.rgba)},t.prototype.toRgbString=function(){return e=U(this.rgba),n=e.r,r=e.g,i=e.b,(u=e.a)<1?"rgba("+n+", "+r+", "+i+", "+u+")":"rgb("+n+", "+r+", "+i+")";var e,n,r,i,u},t.prototype.toHsl=function(){return gt(G(this.rgba))},t.prototype.toHslString=function(){return e=gt(G(this.rgba)),n=e.h,r=e.s,i=e.l,(u=e.a)<1?"hsla("+n+", "+r+"%, "+i+"%, "+u+")":"hsl("+n+", "+r+"%, "+i+"%)";var e,n,r,i,u},t.prototype.toHsv=function(){return e=ct(this.rgba),{h:v(e.h),s:v(e.s),v:v(e.v),a:v(e.a,3)};var e},t.prototype.invert=function(){return z({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),z(X(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),z(X(this.rgba,-e))},t.prototype.grayscale=function(){return z(X(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),z(pt(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),z(pt(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"?z({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):v(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=G(this.rgba);return typeof e=="number"?z({h:e,s:n.s,l:n.l,a:n.a}):v(n.h)},t.prototype.isEqual=function(e){return this.toHex()===z(e).toHex()},t}(),z=function(t){return t instanceof yt?t:new yt(t)};function d(t){return t==null||t==="none"}function O(t,e=0,n=10**e){return Math.round(n*t)/n+0}function R(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(r=>R(r,e)):t;const n={};for(const r in t){const i=t[r];i!=null&&(e?n[r]=R(i,e):n[r]=i)}return n}function M(t,e){const n={};return e.forEach(r=>{r in t&&(n[r]=t[r])}),n}function bt(t,e,n){const r=e.length-1;if(r<0)return t===void 0?n:t;for(let i=0;i<r;i++){if(t==null)return n;t=t[e[i]]}return t==null||t[e[r]]===void 0?n:t[e[r]]}function St(t,e,n){const r=e.length-1;for(let i=0;i<r;i++)typeof t[e[i]]!="object"&&(t[e[i]]={}),t=t[e[i]];t[e[r]]=n}function Ct(t,e,n){return t==null||!e||typeof e!="string"?n:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),bt(t,e.split("."),n))}function wt(t,e,n){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),St(t,e.split("."),n)}class be{_map=new WeakMap;_toRaw(e){if(e&&typeof e=="object"){const n=e.__v_raw;n&&(e=this._toRaw(n))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,n){return this._map.set(this._toRaw(e),this._toRaw(n)),this}}function q(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,z(e)}function Se(t){return{r:O(t.r),g:O(t.g),b:O(t.b),a:O(t.a,3)}}function $(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const I="#000000FF";function _t(t){return q(t).isValid()}function b(t,e=!1){const n=q(t);if(!n.isValid()){if(typeof t=="string")return t;const c=`Failed to normalizeColor ${t}`;if(e)throw new Error(c);return console.warn(c),I}const{r,g:i,b:u,a:s}=Se(n.rgba);return`#${$(r)}${$(i)}${$(u)}${$(O(s*255))}`}var H=H||{};H.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 n(a){const l=new Error(`${e}: ${a}`);throw l.source=e,l}function r(){const a=i();return e.length>0&&n("Invalid input not EOF"),a}function i(){return x(u)}function u(){return s("linear-gradient",t.linearGradient,g)||s("repeating-linear-gradient",t.repeatingLinearGradient,g)||s("radial-gradient",t.radialGradient,w)||s("repeating-radial-gradient",t.repeatingRadialGradient,w)}function s(a,l,f){return c(l,y=>{const E=f();return E&&(h(t.comma)||n("Missing comma before color stops")),{type:a,orientation:E,colorStops:x(Ve)}})}function c(a,l){const f=h(a);if(f){h(t.startCall)||n("Missing (");const y=l(f);return h(t.endCall)||n("Missing )"),y}}function g(){const a=m();if(a)return a;const l=C("position-keyword",t.positionKeywords,1);return l?{type:"directional",value:l.value}:S()}function m(){return C("directional",t.sideOrCorner,1)}function S(){return C("angular",t.angleValue,1)||C("angular",t.radianValue,1)}function w(){let a,l=p(),f;return l&&(a=[],a.push(l),f=e,h(t.comma)&&(l=p(),l?a.push(l):e=f)),a}function p(){let a=L()||Ge();if(a)a.at=ot();else{const l=it();if(l){a=l;const f=ot();f&&(a.at=f)}else{const f=ot();if(f)a={type:"default-radial",at:f};else{const y=at();y&&(a={type:"default-radial",at:y})}}}return a}function L(){const a=C("shape",/^(circle)/i,0);return a&&(a.style=fe()||it()),a}function Ge(){const a=C("shape",/^(ellipse)/i,0);return a&&(a.style=at()||K()||it()),a}function it(){return C("extent-keyword",t.extentKeywords,1)}function ot(){if(C("position",/^at/,0)){const a=at();return a||n("Missing positioning value"),a}}function at(){const a=Ie();if(a.x||a.y)return{type:"position",value:a}}function Ie(){return{x:K(),y:K()}}function x(a){let l=a();const f=[];if(l)for(f.push(l);h(t.comma);)l=a(),l?f.push(l):n("One extra comma");return f}function Ve(){const a=Pe();return a||n("Expected color definition"),a.length=K(),a}function Pe(){return Te()||Be()||We()||$e()||Me()||He()||Ae()}function Ae(){return C("literal",t.literalColor,0)}function Te(){return C("hex",t.hexColor,1)}function Me(){return c(t.rgbColor,()=>({type:"rgb",value:x(A)}))}function $e(){return c(t.rgbaColor,()=>({type:"rgba",value:x(A)}))}function He(){return c(t.varColor,()=>({type:"var",value:je()}))}function We(){return c(t.hslColor,()=>{h(t.percentageValue)&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const l=A();h(t.comma);let f=h(t.percentageValue);const y=f?f[1]:null;h(t.comma),f=h(t.percentageValue);const E=f?f[1]:null;return(!y||!E)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[l,y,E]}})}function Be(){return c(t.hslaColor,()=>{const a=A();h(t.comma);let l=h(t.percentageValue);const f=l?l[1]:null;h(t.comma),l=h(t.percentageValue);const y=l?l[1]:null;h(t.comma);const E=A();return(!f||!y)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[a,f,y,E]}})}function je(){return h(t.variableName)[1]}function A(){return h(t.number)[1]}function K(){return C("%",t.percentageValue,1)||xe()||Ke()||fe()}function xe(){return C("position-keyword",t.positionKeywords,1)}function Ke(){return c(t.calcValue,()=>{let a=1,l=0;for(;a>0&&l<e.length;){const y=e.charAt(l);y==="("?a++:y===")"&&a--,l++}a>0&&n("Missing closing parenthesis in calc() expression");const f=e.substring(0,l-1);return ut(l-1),{type:"calc",value:f}})}function fe(){return C("px",t.pixelValue,1)||C("em",t.emValue,1)}function C(a,l,f){const y=h(l);if(y)return{type:a,value:y[f]}}function h(a){let l,f;return f=/^\s+/.exec(e),f&&ut(f[0].length),l=a.exec(e),l&&ut(l[0].length),l}function ut(a){e=e.substr(a)}return function(a){return e=a.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),r()}}();const zt=H.parse.bind(H);var W=W||{};W.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 n=t.visit(e.orientation);return n&&(n+=", "),e.type+"("+n+t.visit(e.colorStops)+")"},visit_shape:function(e){var n=e.value,r=t.visit(e.at),i=t.visit(e.style);return i&&(n+=" "+i),r&&(n+=" at "+r),n},"visit_default-radial":function(e){var n="",r=t.visit(e.at);return r&&(n+=r),n},"visit_extent-keyword":function(e){var n=e.value,r=t.visit(e.at);return r&&(n+=" at "+r),n},"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,n){var r=e,i=t.visit(n.length);return i&&(r+=" "+i),r},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var n="",r=e.length;return e.forEach(function(i,u){n+=t.visit(i),u<r-1&&(n+=", ")}),n},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 n=t["visit_"+e.type];if(n)return n(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}}();const Ce=W.stringify.bind(W);function Ft(t){const e=t.length-1;return t.map((n,r)=>{const i=n.value;let u=O(r/e,3),s="#00000000";switch(n.type){case"rgb":s=b({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=b({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=b(n.value);break;case"hex":s=b(`#${n.value}`);break}switch(n.length?.type){case"%":u=Number(n.length.value)/100;break}return{offset:u,color:s}})}function Nt(t){let e=0;switch(t.orientation?.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:Ft(t.colorStops)}}function Ot(t){return t.orientation?.map(e=>{switch(e?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:Ft(t.colorStops)}}function V(t){return t.startsWith("linear-gradient(")||t.startsWith("radial-gradient(")}function Rt(t){return zt(t).map(e=>{switch(e?.type){case"linear-gradient":return Nt(e);case"repeating-linear-gradient":return{...Nt(e),repeat:!0};case"radial-gradient":return Ot(e);case"repeating-radial-gradient":return{...Ot(e),repeat:!0};default:return}}).filter(Boolean)}function Et(t){let e;return typeof t=="string"?e={color:t}:e=t,{color:b(e.color)}}function kt(t){let e;if(typeof t=="string"?e={image:t}:e=t,e.image){const{type:n,...r}=Rt(e.image)[0]??{};switch(n){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}}return e}function Dt(t){let e;return typeof t=="string"?e={image:t}:e=t,e}function Lt(t){let e;return typeof t=="string"?e={preset:t}:e=t,{preset:e.preset,foregroundColor:d(e.foregroundColor)?void 0:b(e.foregroundColor),backgroundColor:d(e.backgroundColor)?void 0:b(e.backgroundColor)}}function Gt(t){return!d(t.color)}function It(t){return typeof t=="string"?_t(t):Gt(t)}function Vt(t){return!d(t.image)&&V(t.image)||!!t.linearGradient||!!t.radialGradient}function Pt(t){return typeof t=="string"?V(t):Vt(t)}function At(t){return!d(t.image)&&!V(t.image)}function Tt(t){return typeof t=="string"?!V(t):At(t)}function Mt(t){return!d(t.preset)}function $t(t){return typeof t=="string"?!1:Mt(t)}function N(t){return It(t)?Et(t):Pt(t)?kt(t):Tt(t)?Dt(t):$t(t)?Lt(t):{}}function Ht(t){return typeof t=="string"?{...N(t)}:{...N(t),...M(t,["fillWithShape"])}}const Z=Symbol("properties");function B(t){const e=Object.getPrototypeOf(t);let n;return e&&Object.hasOwn(e,Z)?n=e[Z]:(n=new Map(e?B(e):void 0),e&&(e[Z]=n)),n}function J(t,e={}){const n=Symbol.for(t),{default:r,fallback:i,alias:u}=e,s={declaration:e,internalKey:n},c=()=>typeof r=="function"?r():r,g=()=>typeof i=="function"?i():i;let m=!0;function S(){let p;if(u&&u!==t?p=Ct(this,u):typeof this.getter<"u"?p=this.getter(t,s):p=this[n],p=p??g(),p===void 0&&m){m=!1;const L=c();L!==void 0&&w.call(this,L)}return p}function w(p){u&&u!==t?wt(this,u,p):typeof this.setter<"u"?this.setter(t,p,s):this[n]=p}return{get:S,set:w}}function Wt(t,e,n={}){B(typeof t=="function"?t:t.constructor).set(e,n);const r=J(e,n);Object.defineProperty(t,e,{get(){return r.get.call(this)},set(i){const u=r.get.call(this);r.set.call(this,i),this.onUpdateProperty?.(e,i,u,n)},configurable:!0,enumerable:!0})}function we(t){return function(e,n){if(typeof n!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");Wt(e,n,t)}}function _e(t={}){return function(e,n){const r=n.name;if(typeof r!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");const i=J(r,t);return{init(u){return B(this.constructor).set(r,t),i.set.call(this,u),u},get(){return i.get.call(this)},set(u){const s=i.get?.call(this);i.set.call(this,u),this.onUpdateProperty?.(r,u,s,t)}}}}function Q(){return{color:I,offsetX:0,offsetY:0,blurRadius:1}}function tt(t){return{...Q(),...R({...t,color:d(t.color)?I:b(t.color)})}}function Bt(){return{...Q(),scaleX:1,scaleY:1}}function jt(t){return{...Bt(),...tt(t)}}function ze(t){return t}function xt(t){return R({...t,softEdge:d(t.softEdge)?void 0:t.softEdge,outerShadow:d(t.outerShadow)?void 0:jt(t.outerShadow),innerShadow:d(t.innerShadow)?void 0:tt(t.innerShadow)})}function Kt(t){return typeof t=="string"?{...N(t)}:{...N(t),...M(t,["fillWithShape"])}}const Fe="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Ne=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=Fe[n[t]&63];return e};const Ut=()=>Ne(10),Xt=Ut;function Yt(t){return typeof t=="string"?{...N(t)}:{...N(t),...M(t,["width","style","headEnd","tailEnd"])}}function qt(t){return typeof t=="string"?{color:b(t)}:{...t,color:d(t.color)?I:b(t.color)}}function Zt(){return{boxShadow:"none"}}function Jt(t){return typeof t=="string"?t.startsWith("<svg")?{svg:t}:{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function Qt(){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 te(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function ee(){return{...Qt(),...te(),...Zt(),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 ne(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function re(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function ie(){return{...ne(),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 oe(){return{...re(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function ae(){return{...oe(),...ie(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function D(t){return R({...t,color:d(t.color)?void 0:b(t.color),backgroundColor:d(t.backgroundColor)?void 0:b(t.backgroundColor),borderColor:d(t.borderColor)?void 0:b(t.borderColor),outlineColor:d(t.outlineColor)?void 0:b(t.outlineColor),shadowColor:d(t.shadowColor)?void 0:b(t.shadowColor)})}function Oe(){return{...ee(),...ae()}}const et=/\r\n|\n\r|\n|\r/,Re=new RegExp(`${et.source}|<br\\/>`,"g"),Ee=new RegExp(`^(${et.source})$`),j=`
|
|
2
|
-
`;function ke(t){return et.test(t)}function nt(t){return Ee.test(t)}function ue(t){return t.replace(Re,j)}function le(t,e){const n=Array.from(new Set([...Object.keys(t),...Object.keys(e)]));return!n.length||n.every(r=>t[r]===e[r])}function P(t){const e=[];function n(){return e[e.length-1]}function r(c={}){let g=e[e.length-1];return g?.fragments.length===0?(g={...c,fragments:[]},e[e.length-1]=g):(g={...c,fragments:[]},e.push(g)),g}function i(c="",g={}){Array.from(c).forEach(
|
|
1
|
+
(function(o,D){typeof exports=="object"&&typeof module<"u"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(o=typeof globalThis<"u"?globalThis:o||self,D(o.modernIdoc={}))})(this,function(o){"use strict";function D(t){return typeof t=="string"?{src:t}:t}var de={grad:.9,turn:360,rad:360/(2*Math.PI)},F=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},m=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},_=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},lt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},st=function(t){return{r:_(t.r,0,255),g:_(t.g,0,255),b:_(t.b,0,255),a:_(t.a)}},U=function(t){return{r:m(t.r),g:m(t.g),b:m(t.b),a:m(t.a,3)}},ge=/^#([0-9a-f]{3,8})$/i,T=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},ct=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,u=Math.max(e,n,r),s=u-Math.min(e,n,r),c=s?u===e?(n-r)/s:u===n?2+(r-e)/s:4+(e-n)/s:0;return{h:60*(c<0?c+6:c),s:u?s/u*100:0,v:u/255*100,a:i}},ft=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var u=Math.floor(e),s=r*(1-n),c=r*(1-(e-u)*n),g=r*(1-(1-e+u)*n),p=u%6;return{r:255*[r,c,s,s,g,r][p],g:255*[g,r,r,c,s,s][p],b:255*[s,s,g,r,r,c][p],a:i}},dt=function(t){return{h:lt(t.h),s:_(t.s,0,100),l:_(t.l,0,100),a:_(t.a)}},gt=function(t){return{h:m(t.h),s:m(t.s),l:m(t.l),a:m(t.a,3)}},ht=function(t){return ft((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},G=function(t){return{h:(e=ct(t)).h,s:(i=(200-(n=e.s))*(r=e.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,n,r,i},he=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ve=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,me=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pe=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vt={string:[[function(t){var e=ge.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?m(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?m(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=me.exec(t)||pe.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:st({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=he.exec(t)||ve.exec(t);if(!e)return null;var n,r,i=dt({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(de[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return ht(i)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,i=t.a,u=i===void 0?1:i;return F(e)&&F(n)&&F(r)?st({r:Number(e),g:Number(n),b:Number(r),a:Number(u)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,i=t.a,u=i===void 0?1:i;if(!F(e)||!F(n)||!F(r))return null;var s=dt({h:Number(e),s:Number(n),l:Number(r),a:Number(u)});return ht(s)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,i=t.a,u=i===void 0?1:i;if(!F(e)||!F(n)||!F(r))return null;var s=function(c){return{h:lt(c.h),s:_(c.s,0,100),v:_(c.v,0,100),a:_(c.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(u)});return ft(s)},"hsv"]]},mt=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][1]]}return[null,void 0]},ye=function(t){return typeof t=="string"?mt(t.trim(),vt.string):typeof t=="object"&&t!==null?mt(t,vt.object):[null,void 0]},X=function(t,e){var n=G(t);return{h:n.h,s:_(n.s+100*e,0,100),l:n.l,a:n.a}},Y=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},pt=function(t,e){var n=G(t);return{h:n.h,s:n.s,l:_(n.l+100*e,0,100),a:n.a}},yt=function(){function t(e){this.parsed=ye(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 m(Y(this.rgba),2)},t.prototype.isDark=function(){return Y(this.rgba)<.5},t.prototype.isLight=function(){return Y(this.rgba)>=.5},t.prototype.toHex=function(){return e=U(this.rgba),n=e.r,r=e.g,i=e.b,s=(u=e.a)<1?T(m(255*u)):"","#"+T(n)+T(r)+T(i)+s;var e,n,r,i,u,s},t.prototype.toRgb=function(){return U(this.rgba)},t.prototype.toRgbString=function(){return e=U(this.rgba),n=e.r,r=e.g,i=e.b,(u=e.a)<1?"rgba("+n+", "+r+", "+i+", "+u+")":"rgb("+n+", "+r+", "+i+")";var e,n,r,i,u},t.prototype.toHsl=function(){return gt(G(this.rgba))},t.prototype.toHslString=function(){return e=gt(G(this.rgba)),n=e.h,r=e.s,i=e.l,(u=e.a)<1?"hsla("+n+", "+r+"%, "+i+"%, "+u+")":"hsl("+n+", "+r+"%, "+i+"%)";var e,n,r,i,u},t.prototype.toHsv=function(){return e=ct(this.rgba),{h:m(e.h),s:m(e.s),v:m(e.v),a:m(e.a,3)};var e},t.prototype.invert=function(){return z({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),z(X(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),z(X(this.rgba,-e))},t.prototype.grayscale=function(){return z(X(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),z(pt(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),z(pt(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"?z({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):m(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=G(this.rgba);return typeof e=="number"?z({h:e,s:n.s,l:n.l,a:n.a}):m(n.h)},t.prototype.isEqual=function(e){return this.toHex()===z(e).toHex()},t}(),z=function(t){return t instanceof yt?t:new yt(t)};function d(t){return t==null||t==="none"}function O(t,e=0,n=10**e){return Math.round(n*t)/n+0}function R(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(r=>R(r,e)):t;const n={};for(const r in t){const i=t[r];i!=null&&(e?n[r]=R(i,e):n[r]=i)}return n}function M(t,e){const n={};return e.forEach(r=>{r in t&&(n[r]=t[r])}),n}function bt(t,e,n){const r=e.length-1;if(r<0)return t===void 0?n:t;for(let i=0;i<r;i++){if(t==null)return n;t=t[e[i]]}return t==null||t[e[r]]===void 0?n:t[e[r]]}function St(t,e,n){const r=e.length-1;for(let i=0;i<r;i++)typeof t[e[i]]!="object"&&(t[e[i]]={}),t=t[e[i]];t[e[r]]=n}function Ct(t,e,n){return t==null||!e||typeof e!="string"?n:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),bt(t,e.split("."),n))}function wt(t,e,n){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),St(t,e.split("."),n)}class be{_map=new WeakMap;_toRaw(e){if(e&&typeof e=="object"){const n=e.__v_raw;n&&(e=this._toRaw(n))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,n){return this._map.set(this._toRaw(e),this._toRaw(n)),this}}function q(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,z(e)}function Se(t){return{r:O(t.r),g:O(t.g),b:O(t.b),a:O(t.a,3)}}function $(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const I="#000000FF";function _t(t){return q(t).isValid()}function b(t,e=!1){const n=q(t);if(!n.isValid()){if(typeof t=="string")return t;const c=`Failed to normalizeColor ${t}`;if(e)throw new Error(c);return console.warn(c),I}const{r,g:i,b:u,a:s}=Se(n.rgba);return`#${$(r)}${$(i)}${$(u)}${$(O(s*255))}`}var H=H||{};H.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 n(a){const l=new Error(`${e}: ${a}`);throw l.source=e,l}function r(){const a=i();return e.length>0&&n("Invalid input not EOF"),a}function i(){return x(u)}function u(){return s("linear-gradient",t.linearGradient,g)||s("repeating-linear-gradient",t.repeatingLinearGradient,g)||s("radial-gradient",t.radialGradient,w)||s("repeating-radial-gradient",t.repeatingRadialGradient,w)}function s(a,l,f){return c(l,y=>{const k=f();return k&&(v(t.comma)||n("Missing comma before color stops")),{type:a,orientation:k,colorStops:x(Ve)}})}function c(a,l){const f=v(a);if(f){v(t.startCall)||n("Missing (");const y=l(f);return v(t.endCall)||n("Missing )"),y}}function g(){const a=p();if(a)return a;const l=C("position-keyword",t.positionKeywords,1);return l?{type:"directional",value:l.value}:S()}function p(){return C("directional",t.sideOrCorner,1)}function S(){return C("angular",t.angleValue,1)||C("angular",t.radianValue,1)}function w(){let a,l=h(),f;return l&&(a=[],a.push(l),f=e,v(t.comma)&&(l=h(),l?a.push(l):e=f)),a}function h(){let a=E()||Ge();if(a)a.at=ot();else{const l=it();if(l){a=l;const f=ot();f&&(a.at=f)}else{const f=ot();if(f)a={type:"default-radial",at:f};else{const y=at();y&&(a={type:"default-radial",at:y})}}}return a}function E(){const a=C("shape",/^(circle)/i,0);return a&&(a.style=fe()||it()),a}function Ge(){const a=C("shape",/^(ellipse)/i,0);return a&&(a.style=at()||K()||it()),a}function it(){return C("extent-keyword",t.extentKeywords,1)}function ot(){if(C("position",/^at/,0)){const a=at();return a||n("Missing positioning value"),a}}function at(){const a=Ie();if(a.x||a.y)return{type:"position",value:a}}function Ie(){return{x:K(),y:K()}}function x(a){let l=a();const f=[];if(l)for(f.push(l);v(t.comma);)l=a(),l?f.push(l):n("One extra comma");return f}function Ve(){const a=Pe();return a||n("Expected color definition"),a.length=K(),a}function Pe(){return Te()||Be()||We()||$e()||Me()||He()||Ae()}function Ae(){return C("literal",t.literalColor,0)}function Te(){return C("hex",t.hexColor,1)}function Me(){return c(t.rgbColor,()=>({type:"rgb",value:x(A)}))}function $e(){return c(t.rgbaColor,()=>({type:"rgba",value:x(A)}))}function He(){return c(t.varColor,()=>({type:"var",value:je()}))}function We(){return c(t.hslColor,()=>{v(t.percentageValue)&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const l=A();v(t.comma);let f=v(t.percentageValue);const y=f?f[1]:null;v(t.comma),f=v(t.percentageValue);const k=f?f[1]:null;return(!y||!k)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[l,y,k]}})}function Be(){return c(t.hslaColor,()=>{const a=A();v(t.comma);let l=v(t.percentageValue);const f=l?l[1]:null;v(t.comma),l=v(t.percentageValue);const y=l?l[1]:null;v(t.comma);const k=A();return(!f||!y)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[a,f,y,k]}})}function je(){return v(t.variableName)[1]}function A(){return v(t.number)[1]}function K(){return C("%",t.percentageValue,1)||xe()||Ke()||fe()}function xe(){return C("position-keyword",t.positionKeywords,1)}function Ke(){return c(t.calcValue,()=>{let a=1,l=0;for(;a>0&&l<e.length;){const y=e.charAt(l);y==="("?a++:y===")"&&a--,l++}a>0&&n("Missing closing parenthesis in calc() expression");const f=e.substring(0,l-1);return ut(l-1),{type:"calc",value:f}})}function fe(){return C("px",t.pixelValue,1)||C("em",t.emValue,1)}function C(a,l,f){const y=v(l);if(y)return{type:a,value:y[f]}}function v(a){let l,f;return f=/^\s+/.exec(e),f&&ut(f[0].length),l=a.exec(e),l&&ut(l[0].length),l}function ut(a){e=e.substr(a)}return function(a){return e=a.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),r()}}();const zt=H.parse.bind(H);var W=W||{};W.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 n=t.visit(e.orientation);return n&&(n+=", "),e.type+"("+n+t.visit(e.colorStops)+")"},visit_shape:function(e){var n=e.value,r=t.visit(e.at),i=t.visit(e.style);return i&&(n+=" "+i),r&&(n+=" at "+r),n},"visit_default-radial":function(e){var n="",r=t.visit(e.at);return r&&(n+=r),n},"visit_extent-keyword":function(e){var n=e.value,r=t.visit(e.at);return r&&(n+=" at "+r),n},"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,n){var r=e,i=t.visit(n.length);return i&&(r+=" "+i),r},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var n="",r=e.length;return e.forEach(function(i,u){n+=t.visit(i),u<r-1&&(n+=", ")}),n},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 n=t["visit_"+e.type];if(n)return n(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}}();const Ce=W.stringify.bind(W);function Ft(t){const e=t.length-1;return t.map((n,r)=>{const i=n.value;let u=O(r/e,3),s="#00000000";switch(n.type){case"rgb":s=b({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=b({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=b(n.value);break;case"hex":s=b(`#${n.value}`);break}switch(n.length?.type){case"%":u=Number(n.length.value)/100;break}return{offset:u,color:s}})}function Nt(t){let e=0;switch(t.orientation?.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:Ft(t.colorStops)}}function Ot(t){return t.orientation?.map(e=>{switch(e?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:Ft(t.colorStops)}}function V(t){return t.startsWith("linear-gradient(")||t.startsWith("radial-gradient(")}function Rt(t){return zt(t).map(e=>{switch(e?.type){case"linear-gradient":return Nt(e);case"repeating-linear-gradient":return{...Nt(e),repeat:!0};case"radial-gradient":return Ot(e);case"repeating-radial-gradient":return{...Ot(e),repeat:!0};default:return}}).filter(Boolean)}function Et(t){let e;return typeof t=="string"?e={color:t}:e=t,{color:b(e.color)}}function kt(t){let e;if(typeof t=="string"?e={image:t}:e=t,e.image){const{type:n,...r}=Rt(e.image)[0]??{};switch(n){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}}return e}function Dt(t){let e;return typeof t=="string"?e={image:t}:e=t,e}function Lt(t){let e;return typeof t=="string"?e={preset:t}:e=t,{preset:e.preset,foregroundColor:d(e.foregroundColor)?void 0:b(e.foregroundColor),backgroundColor:d(e.backgroundColor)?void 0:b(e.backgroundColor)}}function Gt(t){return!d(t.color)}function It(t){return typeof t=="string"?_t(t):Gt(t)}function Vt(t){return!d(t.image)&&V(t.image)||!!t.linearGradient||!!t.radialGradient}function Pt(t){return typeof t=="string"?V(t):Vt(t)}function At(t){return!d(t.image)&&!V(t.image)}function Tt(t){return typeof t=="string"?!V(t):At(t)}function Mt(t){return!d(t.preset)}function $t(t){return typeof t=="string"?!1:Mt(t)}function N(t){return It(t)?Et(t):Pt(t)?kt(t):Tt(t)?Dt(t):$t(t)?Lt(t):{}}function Ht(t){return typeof t=="string"?{...N(t)}:{...N(t),...M(t,["fillWithShape"])}}const Z=Symbol("properties");function B(t){const e=Object.getPrototypeOf(t);let n;return e&&Object.hasOwn(e,Z)?n=e[Z]:(n=new Map(e?B(e):void 0),e&&(e[Z]=n)),n}function J(t,e={}){const n=Symbol.for(t),{default:r,fallback:i,alias:u}=e,s={declaration:e,internalKey:n},c=()=>typeof r=="function"?r():r,g=()=>typeof i=="function"?i():i;let p=!0;function S(){let h;if(u&&u!==t?h=Ct(this,u):typeof this.getter<"u"?h=this.getter(t,s):h=this[n],h=h??g(),h===void 0&&p){p=!1;const E=c();E!==void 0&&(w.call(this,E),h=E)}return h}function w(h){u&&u!==t?wt(this,u,h):typeof this.setter<"u"?this.setter(t,h,s):this[n]=h}return{get:S,set:w}}function Wt(t,e,n={}){B(typeof t=="function"?t:t.constructor).set(e,n);const r=J(e,n);Object.defineProperty(t,e,{get(){return r.get.call(this)},set(i){const u=r.get.call(this);r.set.call(this,i),this.onUpdateProperty?.(e,i,u,n)},configurable:!0,enumerable:!0})}function we(t){return function(e,n){if(typeof n!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");Wt(e,n,t)}}function _e(t={}){return function(e,n){const r=n.name;if(typeof r!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");const i=J(r,t);return{init(u){return B(this.constructor).set(r,t),i.set.call(this,u),u},get(){return i.get.call(this)},set(u){const s=i.get?.call(this);i.set.call(this,u),this.onUpdateProperty?.(r,u,s,t)}}}}function Q(){return{color:I,offsetX:0,offsetY:0,blurRadius:1}}function tt(t){return{...Q(),...R({...t,color:d(t.color)?I:b(t.color)})}}function Bt(){return{...Q(),scaleX:1,scaleY:1}}function jt(t){return{...Bt(),...tt(t)}}function ze(t){return t}function xt(t){return R({...t,softEdge:d(t.softEdge)?void 0:t.softEdge,outerShadow:d(t.outerShadow)?void 0:jt(t.outerShadow),innerShadow:d(t.innerShadow)?void 0:tt(t.innerShadow)})}function Kt(t){return typeof t=="string"?{...N(t)}:{...N(t),...M(t,["fillWithShape"])}}const Fe="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Ne=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=Fe[n[t]&63];return e};const Ut=()=>Ne(10),Xt=Ut;function Yt(t){return typeof t=="string"?{...N(t)}:{...N(t),...M(t,["width","style","headEnd","tailEnd"])}}function qt(t){return typeof t=="string"?{color:b(t)}:{...t,color:d(t.color)?I:b(t.color)}}function Zt(){return{boxShadow:"none"}}function Jt(t){return typeof t=="string"?t.startsWith("<svg")?{svg:t}:{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function Qt(){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 te(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function ee(){return{...Qt(),...te(),...Zt(),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 ne(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function re(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function ie(){return{...ne(),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 oe(){return{...re(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function ae(){return{...oe(),...ie(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function L(t){return R({...t,color:d(t.color)?void 0:b(t.color),backgroundColor:d(t.backgroundColor)?void 0:b(t.backgroundColor),borderColor:d(t.borderColor)?void 0:b(t.borderColor),outlineColor:d(t.outlineColor)?void 0:b(t.outlineColor),shadowColor:d(t.shadowColor)?void 0:b(t.shadowColor)})}function Oe(){return{...ee(),...ae()}}const et=/\r\n|\n\r|\n|\r/,Re=new RegExp(`${et.source}|<br\\/>`,"g"),Ee=new RegExp(`^(${et.source})$`),j=`
|
|
2
|
+
`;function ke(t){return et.test(t)}function nt(t){return Ee.test(t)}function ue(t){return t.replace(Re,j)}function le(t,e){const n=Array.from(new Set([...Object.keys(t),...Object.keys(e)]));return!n.length||n.every(r=>t[r]===e[r])}function P(t){const e=[];function n(){return e[e.length-1]}function r(c={}){let g=e[e.length-1];return g?.fragments.length===0?(g={...c,fragments:[]},e[e.length-1]=g):(g={...c,fragments:[]},e.push(g)),g}function i(c="",g={}){Array.from(c).forEach(p=>{if(nt(p)){const{fragments:S,...w}=n()||r();S.length||S.push({...g,content:j}),r(w)}else{const S=n()||r(),w=S.fragments[S.fragments.length-1];if(w){const{content:h,...E}=w;if(le(g,E)){w.content=`${h}${p}`;return}}S.fragments.push({...g,content:p})}})}(Array.isArray(t)?t:[t]).forEach(c=>{if(typeof c=="string")r(),i(c);else if("content"in c){const{content:g,...p}=c;r(L(p)),i(g)}else if("fragments"in c){const{fragments:g,...p}=c;r(L(p)),g.forEach(S=>{const{content:w,...h}=S;i(w,L(h))})}else Array.isArray(c)?(r(),c.forEach(g=>{if(typeof g=="string")i(g);else{const{content:p,...S}=g;i(p,L(S))}})):console.warn("Failed to parse text content",c)});const s=n();return s&&!s.fragments.length&&s.fragments.push({content:j}),e}function se(t){return typeof t=="string"?{content:P(t)}:"content"in t?{...t,content:P(t.content)}:{content:P(t)}}function De(t){return P(t).map(e=>{const n=ue(e.fragments.flatMap(r=>r.content).join(""));return nt(n)?"":n}).join(j)}function ce(t){return typeof t=="string"?{src:t}:t}function rt(t){return R({...t,id:t.id??Xt(),style:d(t.style)?void 0:L(t.style),text:d(t.text)?void 0:se(t.text),background:d(t.background)?void 0:Ht(t.background),shape:d(t.shape)?void 0:Jt(t.shape),fill:d(t.fill)?void 0:N(t.fill),outline:d(t.outline)?void 0:Yt(t.outline),foreground:d(t.foreground)?void 0:Kt(t.foreground),shadow:d(t.shadow)?void 0:qt(t.shadow),video:d(t.video)?void 0:ce(t.video),audio:d(t.audio)?void 0:D(t.audio),effect:d(t.effect)?void 0:xt(t.effect),children:t.children?.map(e=>rt(e))})}function Le(t){return rt(t)}o.RawWeakMap=be,o.clearUndef=R,o.defaultColor=I,o.defineProperty=Wt,o.getDeclarations=B,o.getDefaultElementStyle=ee,o.getDefaultHighlightStyle=ne,o.getDefaultInnerShadow=Q,o.getDefaultLayoutStyle=Qt,o.getDefaultListStyleStyle=re,o.getDefaultOuterShadow=Bt,o.getDefaultShadowStyle=Zt,o.getDefaultStyle=Oe,o.getDefaultTextInlineStyle=ie,o.getDefaultTextLineStyle=oe,o.getDefaultTextStyle=ae,o.getDefaultTransformStyle=te,o.getNestedValue=bt,o.getObjectValueByPath=Ct,o.getPropertyDescriptor=J,o.hasCRLF=ke,o.idGenerator=Xt,o.isCRLF=nt,o.isColor=_t,o.isColorFill=It,o.isColorFillObject=Gt,o.isEqualStyle=le,o.isGradient=V,o.isGradientFill=Pt,o.isGradientFillObject=Vt,o.isImageFill=Tt,o.isImageFillObject=At,o.isNone=d,o.isPresetFill=$t,o.isPresetFillObject=Mt,o.nanoid=Ut,o.normalizeAudio=D,o.normalizeBackground=Ht,o.normalizeCRLF=ue,o.normalizeColor=b,o.normalizeColorFill=Et,o.normalizeDocument=Le,o.normalizeEffect=xt,o.normalizeElement=rt,o.normalizeFill=N,o.normalizeForeground=Kt,o.normalizeGradient=Rt,o.normalizeGradientFill=kt,o.normalizeImageFill=Dt,o.normalizeInnerShadow=tt,o.normalizeOuterShadow=jt,o.normalizeOutline=Yt,o.normalizePresetFill=Lt,o.normalizeShadow=qt,o.normalizeShape=Jt,o.normalizeSoftEdge=ze,o.normalizeStyle=L,o.normalizeText=se,o.normalizeTextContent=P,o.normalizeVideo=ce,o.parseColor=q,o.parseGradient=zt,o.pick=M,o.property=we,o.property2=_e,o.round=O,o.setNestedValue=St,o.setObjectValueByPath=wt,o.stringifyGradient=Ce,o.textContentToString=De,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED