import{Jt as i,dn as a,fn as e,vn as t}from"./vendor-all-0-fRSUBfCr.js";import{zg as n}from"./shared-0-C4kdVF7Y.js";var o=new Set(["none","transparent","currentcolor","inherit","initial","unset","revert","revert-layer"]),r=t().regex(/^[a-zA-Z0-9#(),.\s%-]{1,64}$/).refine(i=>!o.has(i.trim().toLowerCase())).catch("#e5484d"),s=a().min(0),l=e({image_index:a().int().min(1).optional(),image_width:a().int().min(1).optional(),image_height:a().int().min(1).optional(),x1:s.optional(),y1:s.optional(),x2:s.optional(),y2:s.optional(),shape:i(["box","ellipse"]).catch("box"),color:r,label:t().max(40).catch("")});function m(i){const a=l.safeParse(i);if(!a.success)return null;const{image_index:e,image_width:t,image_height:n,x1:o,y1:r,x2:s,y2:m,shape:h,color:c,label:x}=a.data;return void 0===e||void 0===t||void 0===n||void 0===o||void 0===r||void 0===s||void 0===m?null:{imageIndex:e,imageWidth:t,imageHeight:n,x1:Math.min(o,s),y1:Math.min(r,m),x2:Math.max(o,s),y2:Math.max(r,m),shape:h,color:c,label:x}}function h(i){return Math.min(1,Math.max(0,i))}function c(i){const{imageWidth:a,imageHeight:e}=i;return a<=0||e<=0?{x1:0,y1:0,x2:1,y2:1}:{x1:h(i.x1/a),y1:h(i.y1/e),x2:h(i.x2/a),y2:h(i.y2/e)}}function x(i,a){let e=0;for(const t of i)if(t.file_kind===n.Image&&(e+=1,e===a))return t}function d(i){return i.charAt(0).toUpperCase()+i.slice(1)}export{d as i,c as n,m as r,x as t};