UNPKG

@imgproxy/imgproxy-js-core

Version:

imgproxy-js-core package is designed to be used as part of framework-specific packages and plugins.

2 lines (1 loc) 38.1 kB
var imgproxyJsCore=function(f){"use strict";const l=t=>t===!0||t==="t"||t===1?"t":"f",b=t=>`${t}${t.includes(".")?"":" option"}`;function n(t,e,o){if(t===void 0)throw new Error(`${b(e)} is undefined${o?`. ${o}`:""}`)}function z(t,e,o,r){return`${b(t)} value can't be less${r?" or equal":""} than ${e}${o?`. ${o}`:""}`}function i(t,e,o){if(typeof t!="number")throw new Error(`${b(e)} is not a number${o!=null&&o.addInfo?`. ${o==null?void 0:o.addInfo}`:""}`);if(!(o!=null&&o.addParam))return;const r=o.addParam,s=o==null?void 0:o.addInfo;if(r.min!==void 0){if(r.minEqual&&t<=r.min)throw new Error(z(e,r.min,s,!0));if(t<r.min)throw new Error(z(e,r.min,s));if(r.max!==void 0&&t>r.max)throw new Error(`${b(e)} value can't be more than ${r.max}${s?`. ${s}`:""}`)}if(r.isInt&&!Number.isInteger(t))throw new Error(`${b(e)} is must be an integer`)}function d(t,e,o){const r=`Valid values are: ${Object.keys(t).join(", ")}`;if(!t[e])throw new Error(`${b(o)} is invalid. ${r}`)}function xe(t,e,o){if(!t.includes(e)){const r=`Valid values are: ${t.join(", ")}`;throw new Error(`${b(o)} is invalid. ${r}`)}}function $(t,e,o){if(typeof t!="string")throw new Error(`${b(e)} is not a string`);if(o){if(t.match(/[^0-9a-fA-F]/))throw new Error(`${b(e)} must be hexadecimal`);if(t.length!==3&&t.length!==6&&t.length!==8)throw new Error(`${b(e)} must be 3, 6 or 8 characters long (with alpha)`)}}function p(t,e){if(!Array.isArray(t))throw new Error(`${b(e)} is not an array`);if(t.length===0)throw new Error(`${b(e)} is empty`)}function _(t,e){if(typeof t!="boolean")throw new Error(`${b(e)} is not a boolean`)}const x=t=>t.adjust||t.a,Te=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=x(t);n(e,"adjust"),e.brightness!==void 0&&i(e.brightness,"adjust.brightness",{addParam:{min:-255,max:255}});const o=e.brightness??"",r=e.contrast??"",s=e.saturation??"";return`a:${o}:${r}:${s}`},test:t=>!!x(t)},Symbol.toStringTag,{value:"Module"})),Me={none:!0,size:!0,dssim:!0,ml:!0},T=t=>t.autoquality||t.aq,ke=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=T(t);n(e,"autoquality");const{method:o,target:r,min_quality:s,max_quality:a,allowed_error:u}=e;if(o&&d(Me,o,"autoquality.method"),r!==void 0&&i(r,"autoquality.target",{addParam:{min:0}}),s!==void 0&&i(s,"autoquality.min_quality",{addParam:{min:0,max:100}}),a!==void 0&&i(a,"autoquality.max_quality",{addParam:{min:0,max:100}}),u!==void 0){if(o!=="dssim"&&o!=="ml")throw new Error("autoquality.allowed_error is applicable only to dssim and ml methods");i(u,"autoquality.allowed_error",{addParam:{min:0,max:1}})}return`aq:${o??""}:${r??""}:${s??""}:${a??""}:${u??""}`.replace(/:+$/,"")},test:t=>!!T(t)},Symbol.toStringTag,{value:"Module"})),M=t=>{if("auto_rotate"in t)return t.auto_rotate;if("ar"in t)return t.ar},Be=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=M(t);return n(e,"auto_rotate"),`ar:${l(e)}`},test:t=>M(t)!==void 0},Symbol.toStringTag,{value:"Module"})),qe={auto:!0,on:!0,off:!0},k=t=>t.avif_options||t.avifo,Ee=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=k(t);let o;return n(e,"avif_options"),typeof e=="string"?o=e:o=e.subsample,d(qe,o,"avif_options"),`avifo:${o}`},test:t=>!!k(t)},Symbol.toStringTag,{value:"Module"})),B=t=>t.background||t.bg,Ie=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=B(t);if(n(e,"background"),typeof e=="number")throw new Error("background option is not a string or object");return typeof e=="string"?($(e,"background",!0),`bg:${e}`):(n(e.r,"background.r"),n(e.g,"background.g"),n(e.b,"background.b"),i(e.r,"background.r"),i(e.g,"background.g"),i(e.b,"background.b"),`bg:${e.r}:${e.g}:${e.b}`)},test:t=>!!B(t)},Symbol.toStringTag,{value:"Module"})),q=t=>t.background_alpha??t.bga,Ae=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=q(t);return n(e,"background_alpha"),i(e,"background_alpha",{addParam:{min:0,max:1}}),`background_alpha:${e}`},test:t=>!!q(t)},Symbol.toStringTag,{value:"Module"})),E=t=>t.blur??t.bl,Fe=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=E(t);return n(e,"blur"),i(e,"blur",{addParam:{min:0}}),`bl:${e}`},test:t=>!!E(t)},Symbol.toStringTag,{value:"Module"})),I=t=>t.blur_areas??t.ba,Ne=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=I(t);n(e,"blur_areas"),i(e.sigma,"blur_areas.sigma",{addParam:{min:0}}),p(e.areas,"blur_areas.areas");const o=[e.sigma];return e.areas.forEach((r,s)=>{i(r==null?void 0:r.left,`blur_areas.areas[${s}].left`,{addParam:{min:0,max:1}}),i(r.top,`blur_areas.areas[${s}].top`,{addParam:{min:0,max:1}}),i(r.width,`blur_areas.areas[${s}].width`,{addParam:{min:0,max:1}}),i(r.height,`blur_areas.areas[${s}].height`,{addParam:{min:0,max:1}}),o.push(r.left,r.top,r.width,r.height)}),`ba:${o.join(":")}`},test:t=>!!I(t)},Symbol.toStringTag,{value:"Module"})),A=t=>t.blur_detections||t.bd,Re=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=A(t);n(e,"blur_detections"),n(e.sigma,"blur_detections.sigma"),i(e.sigma,"blur_detections.sigma");const o=e.sigma,r=e.class_names?e.class_names.join(":"):"";return`bd:${o}:${r}`.replace(/:+$/,"")},test:t=>!!A(t)},Symbol.toStringTag,{value:"Module"})),F=t=>t.brightness??t.br,Ue=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=F(t);return n(e,"brightness"),i(e,"brightness",{addParam:{min:-255,max:255}}),`br:${e}`},test:t=>!!F(t)},Symbol.toStringTag,{value:"Module"})),N=t=>t.cachebuster||t.cb,R=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=N(t);return n(e,"cachebuster"),$(e,"cachebuster"),`cb:${e}`},test:t=>!!N(t)},Symbol.toStringTag,{value:"Module"})),U=t=>{if("color_profile"in t)return t.color_profile;if("cp"in t)return t.cp;if("icc"in t)return t.icc},Ve=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=U(t);return n(e,"color_profile"),`cp:${e}`},test:t=>U(t)!==void 0},Symbol.toStringTag,{value:"Module"})),V=t=>t.colorize??t.col,Ce=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=V(t);n(e,"colorize");const{opacity:o,color:r,keepAlpha:s}=e;i(o,"colorize.opacity",{addParam:{min:0,max:1}});let a=`col:${o}`;return r&&(a+=`:${r}`),s!==void 0&&(r||(a+=":"),a+=`:${s?1:0}`),a},test:t=>!!V(t)},Symbol.toStringTag,{value:"Module"})),C=t=>t.contrast??t.co,He=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=C(t);return n(e,"contrast"),i(e,"contrast",{addParam:{min:0}}),`co:${e}`},test:t=>!!C(t)},Symbol.toStringTag,{value:"Module"})),H={no:!0,so:!0,ea:!0,we:!0,ce:!0,noea:!0,nowe:!0,soea:!0,sowe:!0},De={...H,sm:!0,fp:!0,obj:!0,objw:!0},D=t=>t.gravity||t.g,v=t=>!!D(t),g=(t,e)=>`${e?"":"g:"}${t.replace(/:+$/,"")}`,h=(t,e={})=>{const{headless:o=!1}=e,r=D(t);n(r,"gravity"),n(r.type,"gravity.type");const s=r.type;if(d(De,s,"gravity.type"),(r.x_offset||r.y_offset)&&d(H,s,"gravity.type"),r.class_names&&s!=="obj")throw new Error("gravity.class_names can be used only with type obj");if(r.class_weights&&s!=="objw")throw new Error("gravity.class_weights can be used only with type objw");if((r.x||r.y)&&s!=="fp")throw new Error("gravity.x and gravity.y can be used only with type fp");if(s==="sm")return g(s,o);if(s==="fp"){const a=r;return n(a.x,"gravity.x"),n(a.y,"gravity.y"),i(a.x,"gravity.x",{addParam:{min:0,max:1}}),i(a.y,"gravity.y",{addParam:{min:0,max:1}}),g(`${s}:${a.x}:${a.y}`,o)}if(s==="obj"){const a=r;n(r.class_names,"gravity.class_names"),p(a.class_names,"gravity.class_names");const u=a.class_names;return g(`${s}:${u.join(":")}`,o)}if(s==="objw"){const a=r;n(a.class_weights,"gravity.class_weights"),p(a.class_weights,"gravity.class_weights");const u=a.class_weights.map(c=>{if(typeof c!="object"||!c.class||typeof c.weight!="number")throw new Error("Each item in gravity.class_weights must have 'class' and 'weight' properties");return`${c.class}:${c.weight}`});return g(`${s}:${u.join(":")}`,o)}else{const a=r,u=a.x_offset===void 0?"":a.x_offset,c=a.y_offset===void 0?"":a.y_offset;return g(`${a.type}:${u}:${c}`,o)}},Qe=Object.freeze(Object.defineProperty({__proto__:null,build:h,test:v},Symbol.toStringTag,{value:"Module"})),Q=t=>t.crop||t.c,X=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Q(t);n(e,"crop");const{width:o,height:r}=e;n(o,"crop.width"),n(r,"crop.height"),i(o,"crop.width",{addParam:{min:0}}),i(r,"crop.height",{addParam:{min:0}});const s=v(e)?h(e,{headless:!0}):"";return`c:${o}:${r}:${s}`.replace(/:+$/,"")},test:t=>!!Q(t)},Symbol.toStringTag,{value:"Module"})),J=t=>t.crop_aspect_ratio||t.crop_ar||t.car,Xe=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=J(t);n(e,"crop_aspect_ratio");const{aspect_ratio:o,enlarge:r}=e;n(o,"crop_aspect_ratio.aspect_ratio"),i(o,"crop_aspect_ratio.aspect_ratio",{addParam:{min:0}});let s=`crop_ar:${o}`;return r!==void 0&&(s+=`:${l(r)}`),s},test:t=>!!J(t)},Symbol.toStringTag,{value:"Module"})),W=t=>{if("disable_animation"in t)return t.disable_animation;if("da"in t)return t.da},Je=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=W(t);return n(e,"disable_animation"),`da:${l(e)}`},test:t=>W(t)!==void 0},Symbol.toStringTag,{value:"Module"})),Y=t=>t.duotone??t.dt,We=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Y(t);n(e,"duotone");const{intensity:o,color1:r="",color2:s=""}=e;return i(o,"duotone.intensity",{addParam:{min:0,max:1}}),s?`dt:${o}:${r}:${s}`:r?`dt:${o}:${r}`:`dt:${o}`},test:t=>!!Y(t)},Symbol.toStringTag,{value:"Module"})),G=t=>t.dpi,Ye=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=G(t);return n(e,"dpi"),i(e,"dpi"),`dpi:${e}`},test:t=>!!G(t)},Symbol.toStringTag,{value:"Module"})),K=t=>t.dpr,Ge=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=K(t);return n(e,"dpr"),i(e,"dpr",{addParam:{min:0}}),`dpr:${e}`},test:t=>!!K(t)},Symbol.toStringTag,{value:"Module"})),L=t=>t.draw_detections||t.dd,Ke=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=L(t);n(e,"draw_detections"),n(e.draw,"draw_detections.draw");const o=l(e.draw),r=e.class_names?`:${e.class_names.join(":")}`:"";return`dd:${o}${r}`},test:t=>!!L(t)},Symbol.toStringTag,{value:"Module"})),Z=t=>{if("enforce_thumbnail"in t)return t.enforce_thumbnail;if("eth"in t)return t.eth},Le=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Z(t);return n(e,"enforce_thumbnail"),`eth:${l(e)}`},test:t=>Z(t)!==void 0},Symbol.toStringTag,{value:"Module"})),tt=t=>{if("enlarge"in t)return t.enlarge;if("el"in t)return t.el},Ze=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=tt(t);return n(e,"enlarge"),`el:${l(e)}`},test:t=>tt(t)!==void 0},Symbol.toStringTag,{value:"Module"})),et=t=>t.expires||t.exp,ot=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=et(t);return n(e,"expires"),i(e,"expires"),`exp:${e}`},test:t=>!!et(t)},Symbol.toStringTag,{value:"Module"})),rt=t=>t.extend||t.ex,w=t=>!!rt(t),to=(t,e)=>`${e?"":"ex:"}${t.replace(/:+$/,"")}`,S=(t,e={})=>{const{headless:o=!1}=e,r=rt(t);n(r,"extend"),n(r.extend,"extend.extend");const s=v(r)?`:${h(r,{headless:!0})}`:"";return to(`${l(r.extend)}${s}`,o)},eo=Object.freeze(Object.defineProperty({__proto__:null,build:S,test:w},Symbol.toStringTag,{value:"Module"})),nt=t=>t.extend_aspect_ratio||t.exar||t.extend_ar,oo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=nt(t);n(e,"extend_aspect_ratio"),n(e.extend,"extend_aspect_ratio.extend");const o=v(e)?`:${h(e,{headless:!0})}`:"";return`exar:${l(e.extend)}${o}`},test:t=>!!nt(t)},Symbol.toStringTag,{value:"Module"})),st=t=>t.fallback_image_url||t.fiu,ro=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=st(t);return n(e,"fallback_image_url"),$(e,"fallback_image_url"),`fiu:${e}`},test:t=>!!st(t)},Symbol.toStringTag,{value:"Module"})),it=t=>t.filename||t.fn,no=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=it(t);n(e,"filename"),n(e.name,"filename.name"),$(e.name,"filename.name");const o=e.encoded===void 0?"":`:${l(e.encoded)}`;return`fn:${e.name}${o}`},test:t=>!!it(t)},Symbol.toStringTag,{value:"Module"})),at=t=>t.flip||t.fl,so=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=at(t);n(e,"flip");const o=e.horizontal??!1,r=e.vertical??!1;return`fl:${l(o)}:${l(r)}`},test:t=>!!at(t)},Symbol.toStringTag,{value:"Module"})),io={png:!0,jpg:!0,jxl:!0,webp:!0,avif:!0,gif:!0,ico:!0,svg:!0,bmp:!0,tiff:!0,mp4:!0,pdf:!0,best:!0},lt=t=>t.format||t.f||t.ext,ao=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=lt(t);return n(e,"format"),d(io,e,"format"),`f:${e}`},test:t=>!!lt(t)},Symbol.toStringTag,{value:"Module"})),ut=t=>t.format_quality||t.fq,lo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=ut(t);n(e,"format_quality"),p(e,"format_quality");const o=[];return e.forEach(r=>{o.push(`${r.format}:${r.quality}`)}),`fq:${o.join(":")}`},test:t=>!!ut(t)},Symbol.toStringTag,{value:"Module"})),uo={down:!0,up:!0,right:!0,left:!0},ct=t=>t.gradient||t.gr,co=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=ct(t);n(e,"gradient");const{opacity:o,color:r,direction:s,start:a,stop:u}=e;return n(o,"gradient.opacity"),i(o,"gradient.opacity",{addParam:{min:0,max:1}}),r&&$(r,"gradient.color",!0),s&&(typeof s=="number"?i(s,"gradient.direction"):($(s,"gradient.direction"),d(uo,s,"gradient.direction"))),a&&i(a,"gradient.start",{addParam:{min:0,max:1}}),u&&i(u,"gradient.stop",{addParam:{min:0,max:1}}),`gr:${o}:${r||""}:${s||""}:${a||""}:${u||""}`.replace(/:+$/,"")},test:t=>!!ct(t)},Symbol.toStringTag,{value:"Module"})),dt=t=>t.height??t.h,bo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=dt(t);return n(e,"height"),i(e,"height",{addParam:{min:0}}),`h:${e}`},test:t=>!!dt(t)},Symbol.toStringTag,{value:"Module"})),bt=t=>t.jpeg_options||t.jpgo,$o=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=bt(t);n(e,"jpeg_options");const{progressive:o,no_subsample:r,trellis_quant:s,overshoot_deringing:a,optimize_scans:u,quant_table:c}=e;if(o&&_(o,"jpeg_options.progressive"),r&&_(r,"jpeg_options.no_subsample"),s&&_(s,"jpeg_options.trellis_quant"),a&&_(a,"jpeg_options.overshoot_deringing"),u&&(_(u,"jpeg_options.optimize_scans"),o===!1))throw new Error("jpeg_options.progressive must be true if jpeg_options.optimize_scans is true");return c&&i(c,"jpeg_options.quant_table",{addParam:{min:0,max:8}}),`jpgo:${o===void 0?"":o}:${r===void 0?"":r}:${s===void 0?"":s}:${a===void 0?"":a}:${u===void 0?"":u}:${c===void 0?"":c}`.replace(/:+$/,"")},test:t=>!!bt(t)},Symbol.toStringTag,{value:"Module"})),$t=t=>{if("keep_copyright"in t)return t.keep_copyright;if("kcr"in t)return t.kcr},_o=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=$t(t);return n(e,"keep_copyright"),`kcr:${l(e)}`},test:t=>$t(t)!==void 0},Symbol.toStringTag,{value:"Module"})),_t=t=>{if("max_animation_frames"in t)return t.max_animation_frames;if("maf"in t)return t.maf},mo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=_t(t);return n(e,"max_animation_frames"),i(e,"max_animation_frames",{addParam:{min:0,minEqual:!0}}),`maf:${e}`},test:t=>_t(t)!==void 0},Symbol.toStringTag,{value:"Module"})),mt=t=>{if("max_animation_frame_resolution"in t)return t.max_animation_frame_resolution;if("mafr"in t)return t.mafr},po=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=mt(t);return n(e,"max_animation_frame_resolution"),i(e,"max_animation_frame_resolution",{addParam:{min:0}}),`mafr:${e}`},test:t=>mt(t)!==void 0},Symbol.toStringTag,{value:"Module"})),pt=t=>t.max_bytes??t.mb,fo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=pt(t);return n(e,"max_bytes"),i(e,"max_bytes",{addParam:{min:0}}),`mb:${e}`},test:t=>!!pt(t)},Symbol.toStringTag,{value:"Module"})),ft=t=>t.max_result_dimension??t.mrd,go=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=ft(t);return n(e,"max_result_dimension"),i(e,"max_result_dimension",{addParam:{min:0}}),`mrd:${e}`},test:t=>ft(t)!==void 0},Symbol.toStringTag,{value:"Module"})),gt=["no","so","ea","we","noea","nowe","soea","sowe","ce"],yo=t=>gt.includes(t.type),yt=t=>t.objects_position||t.obj_pos||t.op,Oo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=yt(t);n(e,"objects_position");const o=e.type;if(xe([...gt,"fp","prop"],o,"type"),yo(e)){e.xOffset!==void 0&&i(e.xOffset,"objects_position.xOffset"),e.yOffset!==void 0&&i(e.yOffset,"objects_position.yOffset");const r=e.xOffset??"",s=e.yOffset??"";return`op:${o}:${r}:${s}`}else if(e.type==="fp"){e.x!==void 0&&i(e.x,"objects_position.x",{addParam:{min:0,max:1}}),e.y!==void 0&&i(e.y,"objects_position.y",{addParam:{min:0,max:1}});const r=e.x??"",s=e.y??"";return`op:${o}:${r}:${s}`}else{if(o==="prop")return"op:prop";throw new Error(`Unknown object position type: ${o}`)}},test:t=>!!yt(t)},Symbol.toStringTag,{value:"Module"})),Ot=t=>{if("max_src_file_size"in t)return t.max_src_file_size;if("msfs"in t)return t.msfs},vt=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Ot(t);return n(e,"max_src_file_size"),i(e,"max_src_file_size",{addParam:{min:0}}),`msfs:${e}`},test:t=>Ot(t)!==void 0},Symbol.toStringTag,{value:"Module"})),ht=t=>{if("max_src_resolution"in t)return t.max_src_resolution;if("msr"in t)return t.msr},jt=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=ht(t);return n(e,"max_src_resolution"),i(e,"max_src_resolution",{addParam:{min:0,minEqual:!0}}),`msr:${e}`},test:t=>ht(t)!==void 0},Symbol.toStringTag,{value:"Module"})),wt=t=>t.min_height??t.mh,vo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=wt(t);return n(e,"min_height"),i(e,"min_height",{addParam:{min:0}}),`mh:${e}`},test:t=>!!wt(t)},Symbol.toStringTag,{value:"Module"})),St=t=>t.min_width??t.mw,ho=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=St(t);return n(e,"min_width"),i(e,"min_width",{addParam:{min:0}}),`mw:${e}`},test:t=>!!St(t)},Symbol.toStringTag,{value:"Module"})),Pt=t=>t.monochrome??t.mc,jo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Pt(t);n(e,"monochrome");const{intensity:o,color:r}=e;return i(o,"monochrome.intensity",{addParam:{min:0,max:1}}),r?`mc:${o}:${r}`:`mc:${o}`},test:t=>!!Pt(t)},Symbol.toStringTag,{value:"Module"})),zt=t=>t.padding||t.pd,wo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=zt(t);if(n(e,"padding"),typeof e=="string")throw new Error("padding option is not a number or object");if(typeof e=="number")return i(e,"padding",{addParam:{min:0}}),`pd:${e}`;e.top!==void 0&&i(e.top,"padding.top"),e.right!==void 0&&i(e.right,"padding.right"),e.bottom!==void 0&&i(e.bottom,"padding.bottom"),e.left!==void 0&&i(e.left,"padding.left");const o=e.top??"",r=e.right??"",s=e.bottom??"",a=e.left??"";return`pd:${o}:${r}:${s}:${a}`.replace(/:+$/,"")},test:t=>!!zt(t)},Symbol.toStringTag,{value:"Module"})),xt=t=>{if("page"in t)return t.page;if("pg"in t)return t.pg},Tt=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=xt(t);return n(e,"page"),i(e,"page",{addParam:{min:0,isInt:!0}}),`pg:${e}`},test:t=>xt(t)!==void 0},Symbol.toStringTag,{value:"Module"})),Mt=t=>{if("pages"in t)return t.pages;if("pgs"in t)return t.pgs},So=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Mt(t);return n(e,"pages"),i(e,"pages",{addParam:{min:1,isInt:!0}}),`pgs:${e}`},test:t=>Mt(t)!==void 0},Symbol.toStringTag,{value:"Module"})),kt=t=>t.pixelate??t.pix,Po=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=kt(t);return n(e,"pixelate"),i(e,"pixelate",{addParam:{min:0}}),`pix:${e}`},test:t=>!!kt(t)},Symbol.toStringTag,{value:"Module"})),Bt=t=>t.png_options||t.pngo,zo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Bt(t);n(e,"png_options");const{interlaced:o,quantize:r,quantization_colors:s}=e;return o&&_(o,"png_options.interlaced"),r&&_(r,"png_options.quantize"),s&&i(s,"png_options.quantization_colors",{addParam:{min:2,max:256}}),`pngo:${o===void 0?"":o}:${r===void 0?"":r}:${s||""}`.replace(/:+$/,"")},test:t=>!!Bt(t)},Symbol.toStringTag,{value:"Module"})),qt=t=>t.preset||t.pr,j=Object.freeze(Object.defineProperty({__proto__:null,build:(t,e)=>{let o=qt(t);if(n(o,"preset"),p(o,"preset"),o.some(r=>typeof r!="string"))throw new Error("preset option should contain only strings");return e!=null&&e.onlyPresets||(o=["pr",...o]),`${o.join(":")}`},test:t=>!!qt(t)},Symbol.toStringTag,{value:"Module"})),Et=t=>t.quality??t.q,xo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Et(t);return n(e,"quality"),i(e,"quality",{addParam:{min:0,max:100}}),`q:${e}`},test:t=>!!Et(t)},Symbol.toStringTag,{value:"Module"})),It=t=>{if("raw"in t)return t.raw},To=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=It(t);return n(e,"raw"),`raw:${l(e)}`},test:t=>It(t)!==void 0},Symbol.toStringTag,{value:"Module"})),Mo={fit:!0,fill:!0,auto:!0,"fill-down":!0,force:!0},At=t=>t.resize||t.rs,ko=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=At(t);n(e,"resize");const{resizing_type:o,width:r,height:s,enlarge:a}=e;o&&d(Mo,o,"resize.resizing_type"),r&&i(r,"resize.width",{addParam:{min:0}}),s&&i(s,"resize.height",{addParam:{min:0}});const u=o||"",c=r||"",m=s||"",y=a===void 0?"":l(a),O=w(e)?S(e,{headless:!0}):"";return`rs:${u}:${c}:${m}:${y}:${O}`.replace(/:+$/,"")},test:t=>!!At(t)},Symbol.toStringTag,{value:"Module"})),Bo={nearest:!0,linear:!0,cubic:!0,lanczos2:!0,lanczos3:!0},Ft=t=>t.resizing_algorithm||t.ra,qo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Ft(t);return n(e,"resizing_algorithm"),d(Bo,e,"resizing_algorithm"),`ra:${e}`},test:t=>!!Ft(t)},Symbol.toStringTag,{value:"Module"})),Eo={fit:!0,fill:!0,"fill-down":!0,force:!0,auto:!0},Nt=t=>t.resizing_type||t.rt,Io=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Nt(t);return n(e,"resizing_type"),d(Eo,e,"resizing_type"),`rt:${e}`},test:t=>!!Nt(t)},Symbol.toStringTag,{value:"Module"})),Rt=t=>{if("return_attachment"in t)return t.return_attachment;if("att"in t)return t.att},Ao=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Rt(t);return n(e,"return_attachment"),`att:${l(e)}`},test:t=>Rt(t)!==void 0},Symbol.toStringTag,{value:"Module"})),Ut={0:!0,90:!0,180:!0,270:!0},Vt=t=>t.rotate??t.rot,Fo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Vt(t),o=`You can use values ${Object.keys(Ut).join(", ")}`;return n(e,"rotate"),i(e,"rotate",{addInfo:o}),d(Ut,e,"rotate"),`rot:${e}`},test:t=>!!Vt(t)},Symbol.toStringTag,{value:"Module"})),Ct=t=>t.saturation??t.sa,No=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Ct(t);return n(e,"saturation"),i(e,"saturation",{addParam:{min:0}}),`sa:${e}`},test:t=>!!Ct(t)},Symbol.toStringTag,{value:"Module"})),Ht=t=>t.sharpen??t.sh,Ro=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Ht(t);return n(e,"sharpen"),i(e,"sharpen",{addParam:{min:0}}),`sh:${e}`},test:t=>!!Ht(t)},Symbol.toStringTag,{value:"Module"})),Dt=t=>t.size||t.s,Uo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Dt(t);n(e,"size");const{width:o,height:r,enlarge:s}=e;o&&i(o,"size.width",{addParam:{min:0}}),r&&i(r,"size.height",{addParam:{min:0}});const a=o||"",u=r||"",c=s===void 0?"":l(s),m=w(e)?S(e,{headless:!0}):"";return`s:${a}:${u}:${c}:${m}`.replace(/:+$/,"")},test:t=>!!Dt(t)},Symbol.toStringTag,{value:"Module"})),Qt=["jpg","jxl","png","webp","avif","gif","ico","svg","heic","bmp","tiff","pdf","mp4"],Xt=t=>t.skip_processing||t.sp,Vo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Xt(t);if(n(e,"skip_processing"),p(e,"skip_processing"),e.some(o=>!Qt.includes(o))){const o=`Valid values are: ${Qt.join(",")}`;throw new Error(`skip_processing option contains unsupported extension. ${o}`)}return`sp:${e.join(":")}`},test:t=>!!Xt(t)},Symbol.toStringTag,{value:"Module"})),Jt=t=>{if("strip_color_profile"in t)return t.strip_color_profile;if("scp"in t)return t.scp},Co=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Jt(t);return n(e,"strip_color_profile"),`scp:${l(e)}`},test:t=>Jt(t)!==void 0},Symbol.toStringTag,{value:"Module"})),Wt=t=>"strip_metadata"in t?t.strip_metadata:"sm"in t?t.sm:void 0,Ho=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Wt(t);return n(e,"strip_metadata"),`sm:${l(e)}`},test:t=>Wt(t)!==void 0},Symbol.toStringTag,{value:"Module"})),Yt=t=>t.style||t.stl,Do=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Yt(t);return n(e,"style"),$(e,"style"),`stl:${e}`},test:t=>!!Yt(t)},Symbol.toStringTag,{value:"Module"})),Gt=t=>t.trim||t.t,Qo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Gt(t);n(e,"trim");const{threshold:o,color:r,equal_hor:s,equal_ver:a}=e;n(o,"trim.threshold"),i(o,"trim.threshold"),r&&$(r,"trim.color",!0);const u=s===void 0?"":l(s),c=a===void 0?"":l(a);return`t:${o}:${r||""}:${u}:${c}`.replace(/:+$/,"")},test:t=>!!Gt(t)},Symbol.toStringTag,{value:"Module"})),Xo={auto:!0,none:!0,always:!0},Kt=t=>t.unsharp_masking||t.ush,Jo=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Kt(t);n(e,"unsharp_masking");const{mode:o,weight:r,divider:s}=e;return o&&d(Xo,o,"unsharp_masking.mode"),r!==void 0&&i(r,"unsharp_masking.weight",{addParam:{min:0,minEqual:!0}}),s!==void 0&&i(s,"unsharp_masking.divider",{addParam:{min:0,minEqual:!0}}),`ush:${o||""}:${r||""}:${s||""}`.replace(/:+$/,"")},test:t=>!!Kt(t)},Symbol.toStringTag,{value:"Module"})),Lt=t=>{if("video_thumbnail_second"in t)return t.video_thumbnail_second;if("vts"in t)return t.vts},Zt=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Lt(t);return n(e,"video_thumbnail_second"),i(e,"video_thumbnail_second",{addParam:{min:1,isInt:!0}}),`vts:${e}`},test:t=>Lt(t)!==void 0},Symbol.toStringTag,{value:"Module"}));function te(t){return t.video_thumbnail_animation||t.vta}function Wo(t){return!!te(t)}function Yo(t){const e=te(t);n(e,"video_thumbnail_animation"),i(e.step,"video_thumbnail_animation.step"),i(e.delay,"video_thumbnail_animation.delay"),i(e.frames,"video_thumbnail_animation.frames"),e.frame_width!==void 0&&i(e.frame_width,"video_thumbnail_animation.frame_width"),e.frame_height!==void 0&&i(e.frame_height,"video_thumbnail_animation.frame_height");const o=[],r=e.extend_frame!==void 0?l(e.extend_frame):void 0,s=e.trim!==void 0?l(e.trim):void 0,a=e.fill!==void 0?l(e.fill):void 0;for(o.push(r,s,a),a==="t"&&o.push(e.focus_x,e.focus_y);o.length>0&&o[o.length-1]===void 0;)o.pop();const u=o.length>0?`:${o.join(":")}`:"";return`vta:${e.step}:${e.delay}:${e.frames}:${e.frame_width}:${e.frame_height}${u}`}const Go=Object.freeze(Object.defineProperty({__proto__:null,build:Yo,test:Wo},Symbol.toStringTag,{value:"Module"}));function ee(t){return t.video_thumbnail_tile||t.vtt}function Ko(t){return!!ee(t)}function Lo(t){const e=ee(t);n(e,"video_thumbnail_tile"),i(e.step,"video_thumbnail_tile.step"),i(e.columns,"video_thumbnail_tile.columns"),i(e.rows,"video_thumbnail_tile.rows"),i(e.tile_width,"video_thumbnail_tile.tile_width"),i(e.tile_height,"video_thumbnail_tile.tile_height");const o=[],r=e.extend_tile!==void 0?l(e.extend_tile):void 0,s=e.trim!==void 0?l(e.trim):void 0,a=e.fill!==void 0?l(e.fill):void 0;for(o.push(r,s,a),a==="t"&&o.push(e.focus_x,e.focus_y);o.length>0&&o[o.length-1]===void 0;)o.pop();const u=o.length>0?`:${o.join(":")}`:"";return`vtt:${e.step}:${e.columns}:${e.rows}:${e.tile_width}:${e.tile_height}${u}`}const Zo=Object.freeze(Object.defineProperty({__proto__:null,build:Lo,test:Ko},Symbol.toStringTag,{value:"Module"})),tr={ce:!0,no:!0,so:!0,ea:!0,we:!0,noea:!0,nowe:!0,soea:!0,sowe:!0,re:!0,ch:!0},oe=t=>t.watermark||t.wm,er=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=oe(t);n(e,"watermark");const{opacity:o,position:r,x_offset:s,y_offset:a,scale:u}=e;return n(o,"watermark.opacity"),i(o,"watermark.opacity",{addParam:{min:0,max:1}}),r&&($(r,"watermark.position"),d(tr,r,"watermark.position")),s&&i(s,"watermark.x_offset"),a&&i(a,"watermark.y_offset"),u&&i(u,"watermark.scale"),`wm:${o}:${r||""}:${s||""}:${a||""}:${u||""}`.replace(/:+$/,"")},test:t=>!!oe(t)},Symbol.toStringTag,{value:"Module"})),re=t=>t.watermark_shadow??t.wmsh,or=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=re(t);return n(e,"watermark_shadow"),i(e,"watermark_shadow",{addParam:{min:0}}),`wmsh:${e}`},test:t=>!!re(t)},Symbol.toStringTag,{value:"Module"})),ne=t=>t.watermark_size||t.wms,rr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=ne(t);n(e,"watermark_size");const{width:o,height:r}=e;return o&&i(o,"watermark_size.width",{addParam:{min:0}}),r&&i(r,"watermark_size.height",{addParam:{min:0}}),`wms:${o||""}:${r||""}`.replace(/:+$/,"")},test:t=>!!ne(t)},Symbol.toStringTag,{value:"Module"})),se=t=>t.watermark_text||t.wmt,nr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=se(t);return n(e,"watermark_text"),$(e,"watermark_text"),`wmt:${e}`},test:t=>!!se(t)},Symbol.toStringTag,{value:"Module"})),ie=t=>t.watermark_url||t.wmu,sr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=ie(t);return n(e,"watermark_url"),$(e,"watermark_url"),`wmu:${e}`},test:t=>!!ie(t)},Symbol.toStringTag,{value:"Module"})),ir={lossy:!0,near_lossless:!0,lossless:!0},ar={default:!0,photo:!0,picture:!0,drawing:!0,icon:!0,text:!0},ae=t=>t.webp_options||t.webpo,lr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=ae(t);let o,r,s;n(e,"webp_options"),typeof e=="string"?o=e:(o=e.compression,e.smart_subsample!==void 0&&(r=e.smart_subsample,_(r,"webp_options.smart_subsample")),e.preset!==void 0&&(s=e.preset,d(ar,s,"webp_options.preset"))),d(ir,o,"webp_options");let a=`webpo:${o}`;return(r!==void 0||s!==void 0)&&(a+=`:${r!==void 0?r:""}`),s!==void 0&&(a+=`:${s}`),a},test:t=>!!ae(t)},Symbol.toStringTag,{value:"Module"})),le=t=>t.width??t.w,ur=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=le(t);return n(e,"width"),i(e,"width",{addParam:{min:0}}),`w:${e}`},test:t=>!!le(t)},Symbol.toStringTag,{value:"Module"})),P=(t,e)=>{n(t,e),i(t,e,{addParam:{min:0}})},ue=t=>t.zoom||t.z,cr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=ue(t);return n(e,"zoom"),typeof e=="string"&&i(e,"zoom"),typeof e=="number"?(P(e,"zoom"),`z:${e}`):(P(e.zoom_x,"zoom.zoom_x"),P(e.zoom_y,"zoom.zoom_y"),`z:${e.zoom_x}:${e.zoom_y}`)},test:t=>!!ue(t)},Symbol.toStringTag,{value:"Module"})),dr=t=>t.wild_options,ce=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=t.wild_options;if(n(e,"raw_options"),p(e,"raw_options"),!e.every(r=>Array.isArray(r)))throw new Error("raw_options is not an array of arrays");let o="";for(let r=0;r<e.length;r++){let s="";for(let a=0;a<e[r].length;a++)a>0&&(s+=":"),s+=e[r][a];r>0&&(o+="/"),o+=s}return o},test:t=>!!dr(t)},Symbol.toStringTag,{value:"Module"})),br=Object.freeze(Object.defineProperty({__proto__:null,adjust:Te,autoRotate:Be,autoquality:ke,avifOptions:Ee,background:Ie,backgroundAlpha:Ae,blur:Fe,blurAreas:Ne,blurDetections:Re,brightness:Ue,cacheBuster:R,colorProfile:Ve,colorize:Ce,contrast:He,crop:X,cropAspectRatio:Xe,disableAnimation:Je,dpi:Ye,dpr:Ge,drawDetections:Ke,duotone:We,enforceThumbnail:Le,enlarge:Ze,expires:ot,extend:eo,extendAspectRatio:oo,fallbackImageUrl:ro,filename:no,flip:so,format:ao,formatQuality:lo,gradient:co,gravity:Qe,height:bo,jpegOptions:$o,keepCopyright:_o,maxAnimationFrameResolution:po,maxAnimationFrames:mo,maxBytes:fo,maxResultDimension:go,maxSrcFileSize:vt,maxSrcResolution:jt,minHeight:vo,minWidth:ho,monochrome:jo,objectPosition:Oo,padding:wo,page:Tt,pages:So,pixelate:Po,pngOptions:zo,preset:j,quality:xo,raw:To,resize:ko,resizingAlgorithm:qo,resizingType:Io,returnAttachment:Ao,rotate:Fo,saturation:No,sharpen:Ro,size:Uo,skipProcessing:Vo,stripColorProfile:Co,stripMetadata:Ho,style:Do,trim:Qo,unsharpMasking:Jo,videoThumbnailAnimation:Go,videoThumbnailSecond:Zt,videoThumbnailTile:Zo,watermark:er,watermarkShadow:or,watermarkSize:rr,watermarkText:nr,watermarkUrl:sr,webpOptions:lr,width:ur,wildOptions:ce,zoom:cr},Symbol.toStringTag,{value:"Module"})),de={plain:!0,base64:!0,encrypted:!0},$r=Object.values(br),_r=[j],mr=(t,e,o)=>{if(n(t.value,"url.value","Must be a string"),n(t.type,"url.type",`Valid values are: ${Object.keys(de).join(", ")}`),d(de,t.type,"url.type"),t.filename&&t.type==="plain")throw new Error("url.filename is only valid for base64 or encrypted url");let r="";if(e){const a=o!=null&&o.onlyPresets?_r:$r;for(const u of a)u.test(e)&&(r+="/",r+=u.build(e,o))}let s="";return t.type==="plain"?s=`/plain/${t.value}`:t.type==="base64"?s=`/${t.value}`:t.type==="encrypted"&&(s=`/enc/${t.value}`),t.filename&&(s+=`/${t.filename}`),`${r}${s}`},be=t=>{if("average"in t)return t.average;if("avg"in t)return t.avg},pr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=be(t);n(e,"average"),n(e.average,"average.average");const o=e.ignore_transparent===void 0?"":`:${l(e.ignore_transparent)}`;return`avg:${l(e.average)}${o}`},test:t=>be(t)!==void 0},Symbol.toStringTag,{value:"Module"})),$e=t=>{if("blurhash"in t)return t.blurhash;if("bh"in t)return t.bh},fr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=$e(t);n(e,"blurhash");const{x_components:o,y_components:r}=e;return n(o,"blurhash.x_components"),n(r,"blurhash.y_components"),i(o,"blurhash.x_components",{addParam:{min:0,max:9}}),i(r,"blurhash.y_components",{addParam:{min:0,max:9}}),`bh:${o}:${r}`},test:t=>$e(t)!==void 0},Symbol.toStringTag,{value:"Module"})),_e=t=>{if("calcHashsums"in t)return t.calcHashsums;if("chs"in t)return t.chs},gr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=_e(t);return n(e,"calcHashsums"),e.length?`chs:${e.join(":")}`:"chs:"},test:t=>_e(t)!==void 0},Symbol.toStringTag,{value:"Module"})),me=t=>{if("detect_objects"in t)return t.detect_objects;if("do"in t)return t.do},yr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=me(t);return n(e,"detect_objects"),`do:${l(e)}`},test:t=>me(t)!==void 0},Symbol.toStringTag,{value:"Module"})),pe=t=>{if("dimensions"in t)return t.dimensions;if("d"in t)return t.d},Or=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=pe(t);return n(e,"dimensions"),`d:${l(e)}`},test:t=>pe(t)!==void 0},Symbol.toStringTag,{value:"Module"})),fe=t=>{if("dominant_colors"in t)return t.dominant_colors;if("dc"in t)return t.dc},vr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=fe(t);n(e,"dominant_colors"),n(e.dominant_colors,"dominant_colors.dominant_colors");const o=e.build_missed===void 0?"":`:${l(e.build_missed)}`;return`dc:${l(e.dominant_colors)}${o}`},test:t=>fe(t)!==void 0},Symbol.toStringTag,{value:"Module"})),ge=t=>{if("exif"in t)return t.exif},hr=t=>ge(t)!==void 0,jr=t=>typeof t=="object"&&t!==null,wr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=ge(t);if(n(e,"EXIF"),!jr(e))return`exif:${l(e)}`;const{enabled:o,canonical_names:r}=e,s=o!==void 0?l(o):"t";return r===void 0?`exif:${s}`:`exif:${s}:${l(r)}`},test:hr},Symbol.toStringTag,{value:"Module"})),ye=t=>{if("format"in t)return t.format;if("f"in t)return t.f},Sr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=ye(t);return n(e,"format"),`f:${l(e)}`},test:t=>ye(t)!==void 0},Symbol.toStringTag,{value:"Module"})),Oe=t=>{if("iptc"in t)return t.iptc},Pr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Oe(t);return n(e,"IPTC"),`iptc:${l(e)}`},test:t=>Oe(t)!==void 0},Symbol.toStringTag,{value:"Module"})),ve=t=>{if("pages_number"in t)return t.pages_number;if("pn"in t)return t.pn},zr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=ve(t);return n(e,"pages_number"),`pn:${l(e)}`},test:t=>ve(t)!==void 0},Symbol.toStringTag,{value:"Module"})),he=t=>{if("palette"in t)return t.palette;if("p"in t)return t.p},xr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=he(t);if(n(e,"palette"),i(e,"palette",{addParam:{min:0,max:256,isInt:!0}}),e===1)throw new Error("palette option is should be 0 or between 2 and 256");return`p:${e}`},test:t=>he(t)!==void 0},Symbol.toStringTag,{value:"Module"})),je=t=>{if("size"in t)return t.size;if("s"in t)return t.s},Tr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=je(t);return n(e,"size"),`s:${l(e)}`},test:t=>je(t)!==void 0},Symbol.toStringTag,{value:"Module"})),we=t=>{if("video_meta"in t)return t.video_meta;if("vm"in t)return t.vm},Mr=Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=we(t);return n(e,"video_meta"),`vm:${l(e)}`},test:t=>we(t)!==void 0},Symbol.toStringTag,{value:"Module"})),Se=t=>{if("xmp"in t)return t.xmp},kr=Object.freeze(Object.defineProperty({__proto__:null,average:pr,blurhash:fr,cacheBuster:R,calcHashsums:gr,crop:X,detectObjects:yr,dimensions:Or,dominantColors:vr,exif:wr,expires:ot,format:Sr,iptc:Pr,maxSrcFileSize:vt,maxSrcResolution:jt,page:Tt,pagesNumber:zr,palette:xr,preset:j,size:Tr,videoMeta:Mr,videoThumbnailSecond:Zt,wildOptions:ce,xmp:Object.freeze(Object.defineProperty({__proto__:null,build:t=>{const e=Se(t);return n(e,"XMP"),`xmp:${l(e)}`},test:t=>Se(t)!==void 0},Symbol.toStringTag,{value:"Module"}))},Symbol.toStringTag,{value:"Module"})),Pe={plain:!0,base64:!0,encrypted:!0},Br=Object.values(kr),qr=[j],Er=(t,e,o)=>{if(n(t.value,"url.value","Must be a string"),n(t.type,"url.type",`Valid values are: ${Object.keys(Pe).join(", ")}`),d(Pe,t.type,"url.type"),t.filename&&t.type==="plain")throw new Error("url.filename is only valid for base64 or encrypted url");let r="";if(e){const a=o!=null&&o.onlyPresets?qr:Br;for(const u of a)u.test(e)&&(r+="/",r+=u.build(e,o))}let s="";return t.type==="plain"?s=`/plain/${t.value}`:t.type==="base64"?s=`/${t.value}`:t.type==="encrypted"&&(s=`/enc/${t.value}`),t.filename&&(s+=`/${t.filename}`),`${r}${s}`},Ir="/info";return f.INFO_PREFIX=Ir,f.generateImageInfoUrl=Er,f.generateUrl=mr,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}),f}({});