import{encode as t,decode as e}from"../../utils/url.mjs";import{decode as i}from"../../utils/string.mjs";import{Url as s,Function as r,String as o,RightParenthesis as n}from"../../tokenizer/types.mjs";import"../../tokenizer/char-code-definitions.mjs";import"../../tokenizer/TokenStream.mjs";const a="Url",h={value:String};function m(){const t=this.tokenStart;let a;switch(this.tokenType){case s:a=e(this.consume(s));break;case r:this.cmpStr(this.tokenStart,this.tokenEnd,"url(")||this.error("Function name must be `url`"),this.eat(r),this.skipSC(),a=i(this.consume(o)),this.skipSC(),this.eof||this.eat(n);break;default:this.error("Url or Function is expected")}return{type:"Url",loc:this.getLocation(t,this.tokenStart),value:a}}function c(e){this.token(s,t(e.value))}export{c as generate,a as name,m as parse,h as structure};