import{__module as t}from"../../../_virtual/processor.mjs";import{__require as r}from"./parser.mjs";var n;function o(){return n||(n=1,function(t,n){n.__esModule=!0,n.default=void 0;var o,e=(o=r())&&o.__esModule?o:{default:o};var s=function(){function t(t,r){this.func=t||function(){},this.funcRes=null,this.options=r}var r=t.prototype;return r._shouldUpdateSelector=function(t,r){return void 0===r&&(r={}),!1!==Object.assign({},this.options,r).updateSelector&&"string"!=typeof t},r._isLossy=function(t){return void 0===t&&(t={}),!1===Object.assign({},this.options,t).lossless},r._root=function(t,r){return void 0===r&&(r={}),new e.default(t,this._parseOptions(r)).root},r._parseOptions=function(t){return{lossy:this._isLossy(t)}},r._run=function(t,r){var n=this;return void 0===r&&(r={}),new Promise(function(o,e){try{var s=n._root(t,r);Promise.resolve(n.func(s)).then(function(o){var e=void 0;return n._shouldUpdateSelector(t,r)&&(e=s.toString(),t.selector=e),{transform:o,root:s,string:e}}).then(o,e)}catch(t){return void e(t)}})},r._runSync=function(t,r){void 0===r&&(r={});var n=this._root(t,r),o=this.func(n);if(o&&"function"==typeof o.then)throw new Error("Selector processor returned a promise to a synchronous call.");var e=void 0;return r.updateSelector&&"string"!=typeof t&&(e=n.toString(),t.selector=e),{transform:o,root:n,string:e}},r.ast=function(t,r){return this._run(t,r).then(function(t){return t.root})},r.astSync=function(t,r){return this._runSync(t,r).root},r.transform=function(t,r){return this._run(t,r).then(function(t){return t.transform})},r.transformSync=function(t,r){return this._runSync(t,r).transform},r.process=function(t,r){return this._run(t,r).then(function(t){return t.string||t.root.toString()})},r.processSync=function(t,r){var n=this._runSync(t,r);return n.string||n.root.toString()},t}();n.default=s,t.exports=n.default}(t,t.exports)),t.exports}export{o as __require};