Files
documentation/node_modules/style-to-object/dist/style-to-object.min.js
2024-03-22 03:47:51 +05:30

3 lines
2.1 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).StyleToObject=t()}(this,(function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t={exports:{}},r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,o=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,u=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,a=/^\s+|\s+$/g,s="";function l(e){return e?e.replace(a,s):s}var p=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var a=1,p=1;function h(e){var t=e.match(n);t&&(a+=t.length);var r=e.lastIndexOf("\n");p=~r?e.length-r:p+e.length}function v(){var e={line:a,column:p};return function(t){return t.position=new d(e),g(),t}}function d(e){this.start=e,this.end={line:a,column:p},this.source=t.source}function m(r){var n=new Error(t.source+":"+a+":"+p+": "+r);if(n.reason=r,n.filename=t.source,n.line=a,n.column=p,n.source=e,!t.silent)throw n}function y(t){var r=t.exec(e);if(r){var n=r[0];return h(n),e=e.slice(n.length),r}}function g(){y(o)}function x(e){var t;for(e=e||[];t=w();)!1!==t&&e.push(t);return e}function w(){var t=v();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var r=2;s!=e.charAt(r)&&("*"!=e.charAt(r)||"/"!=e.charAt(r+1));)++r;if(r+=2,s===e.charAt(r-1))return m("End of comment missing");var n=e.slice(2,r-2);return p+=2,h(n),e=e.slice(r),p+=2,t({type:"comment",comment:n})}}function b(){var e=v(),t=y(i);if(t){if(w(),!y(u))return m("property missing ':'");var n=y(c),o=e({type:"declaration",property:l(t[0].replace(r,s)),value:n?l(n[0].replace(r,s)):s});return y(f),o}}return d.prototype.content=e,g(),function(){var e,t=[];for(x(t);e=b();)!1!==e&&(t.push(e),x(t));return t}()};function h(e,t){var r,n=null;if(!e||"string"!=typeof e)return n;for(var o,i,u=p(e),c="function"==typeof t,f=0,a=u.length;f<a;f++)o=(r=u[f]).property,i=r.value,c?t(o,i,r):i&&(n||(n={}),n[o]=i);return n}return t.exports=h,t.exports.default=h,e(t.exports)}));
//# sourceMappingURL=style-to-object.min.js.map