import{__exports as r}from"../../../_virtual/esnext.string.dedent.mjs";import{__require as e}from"../internals/freezing.mjs";import{__require as t}from"../internals/export.mjs";import{__require as n}from"../internals/make-built-in.mjs";import{__require as i}from"../internals/function-uncurry-this.mjs";import{__require as a}from"../internals/function-apply.mjs";import{__require as o}from"../internals/an-object.mjs";import{__require as s}from"../internals/to-object.mjs";import{__require as m}from"../internals/is-callable.mjs";import{__require as f}from"../internals/length-of-array-like.mjs";import{__require as l}from"../internals/object-define-property.mjs";import{__require as u}from"../internals/array-slice.mjs";import{__require as p}from"../internals/weak-map-helpers.mjs";import{__require as _}from"../internals/string-cooked.mjs";import{__require as g}from"../internals/string-parse.mjs";import{__require as h}from"../internals/whitespaces.mjs";var c;function j(){if(c)return r;c=1;var j=e(),v=t(),q=n(),w=i(),d=a(),b=o(),y=s(),x=m(),k=f(),z=l().f,E=u(),I=p(),O=_(),R=g(),A=h(),M=new I.WeakMap,F=I.get,S=I.has,T=I.set,W=Array,B=TypeError,C=Object.freeze||Object,D=Object.isFrozen,G=Math.min,H=w("".charAt),J=w("".slice),K=w("".split),L=w(/./.exec),N=/([\n\u2028\u2029]|\r\n?)/g,P=RegExp("^["+A+"]*"),Q=RegExp("[^"+A+"]"),U="Invalid tag",V=function(r){var e,t,n,i,a=y(r),o=k(a),s=W(o),m=W(o),f=0;if(!o)throw new B(U);for(;f<o;f++){var l=a[f];if("string"!=typeof l)throw new B(U);s[f]=K(l,N)}for(f=0;f<o;f++){var u=f+1===o;if(e=s[f],0===f){if(1===e.length||e[0].length>0)throw new B("Invalid opening line");e[1]=""}if(u){if(1===e.length||L(Q,e[e.length-1]))throw new B("Invalid closing line");e[e.length-2]="",e[e.length-1]=""}for(var p=2;p<e.length;p+=2){var _=e[p],g=p+1===e.length&&!u,h=L(P,_)[0];g||h.length!==_.length?t=X(h,t):e[p]=""}}var c=t?t.length:0;for(f=0;f<o;f++){for(n=(e=s[f])[0],i=1;i<e.length;i+=2)n+=e[i]+J(e[i+1],c);m[f]=n}return m},X=function(r,e){if(void 0===e||r===e)return r;for(var t=0,n=G(r.length,e.length);t<n&&H(r,t)===H(e,t);t++);return J(r,0,t)},Y=function(r){for(var e=0,t=r.length,n=W(t);e<t;e++)n[e]=R(r[e]);return n},Z=function(r){return q(function(e){var t=E(arguments);return t[0]=function(r){var e=r.raw;if(j&&!D(e))throw new B("Raw template should be frozen");if(S(M,e))return F(M,e);var t=V(e),n=Y(t);return z(n,"raw",{value:C(t)}),C(n),T(M,e,n),n}(b(e)),d(r,this,t)},"")},$=Z(O);return v({target:"String",stat:!0,forced:!0},{dedent:function(r){return b(r),x(r)?Z(r):d($,this,arguments)}}),r}export{j as __require};