import{c as dr,j as h,B as G,S as Kr,X as Yr,r as F,L as Ot,u as Ge,g as Jr,a as Qr,e as ln}from"./main-pzSpmpV2.js";import{u as Gr,D as Zr}from"./layout-D23Ks5S8.js";import{D as Wr}from"./date-range-picker-DNoqLdwE.js";import{I as ei}from"./input-6kwZWIt9.js";import{D as ti,a as ni,b as ri,c as ii,d as oi,e as ai,f as X}from"./data-table-column-header-DXeZFhtt.js";import{C as si,a as li,D as ui}from"./data-table-faceted-filter-kNYtu19G.js";import{D as fi}from"./data-table-CFJjNL4R.js";import{F as cr}from"./FetchWrapper-DtDh1OOQ.js";import{B as di}from"./badge-DNC7XzqG.js";import{C as un}from"./checkbox-CIGiMGP9.js";import{D as ci}from"./delete-dialog-DT_Wug03.js";import{P as hi,T as gi}from"./trash-2-D4pTFDxR.js";import{C as mi}from"./copy-DtobOUsE.js";import{D as pi,a as bi,b as yi,c as xi,d as Mi}from"./dialog-CwPbkvSr.js";import"./popover-CdzFhe13.js";import"./index-BtdXaa8D.js";import"./chevron-right-aCSBeO6-.js";import"./chevrons-up-down-ZAOsMAOK.js";import"./command-CpAAY9qL.js";import"./separator-C1IUkfHl.js";import"./table-Di4jwPel.js";import"./spinner-BwGdrg0I.js";import"./loader-2-fAceJRLq.js";/**
 * @license lucide-react v0.302.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wi=dr("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
 * @license lucide-react v0.302.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vi=dr("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);function Ci({table:e}){return h.jsxs(ti,{children:[h.jsx(ni,{asChild:!0,children:h.jsxs(G,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[h.jsx(Kr,{}),"View"]})}),h.jsxs(ri,{align:"end",className:"w-[150px]",children:[h.jsx(ii,{children:"Toggle columns"}),h.jsx(oi,{}),e.getAllColumns().filter(t=>typeof t.accessorFn<"u"&&t.getCanHide()).map(t=>h.jsx(ai,{className:"capitalize",checked:t.getIsVisible(),onCheckedChange:n=>t.toggleVisibility(!!n),children:t.id},t.id))]})]})}const ki=[{value:"active",label:"Active",icon:si},{value:"inactive",label:"Inactive",icon:li}];function Ni({table:e,children:t}){var i;const n=e.getState().columnFilters.length>0;return h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[h.jsx(ei,{placeholder:"Search Campaigns...",value:((i=e.getColumn("name"))==null?void 0:i.getFilterValue())??"",onChange:r=>{var o;return(o=e.getColumn("name"))==null?void 0:o.setFilterValue(r.target.value)},className:"h-8 w-[150px] lg:w-[250px]"}),e.getColumn("status")&&h.jsx(ui,{column:e.getColumn("status"),title:"Status",options:ki}),n&&h.jsxs(G,{variant:"ghost",onClick:()=>e.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:["Reset",h.jsx(Yr,{})]})]}),t,h.jsx(Ci,{table:e})]})}function Ti({row:e,onRefresh:t}){const[n,i]=F.useState(!1),[r,o]=F.useState(!1),a=async s=>{try{o(!0),new cr(linkfiliate.pluginApiUrl,linkfiliate.nonce).delete(`/campaign/delete/${s}`).then(u=>{u.status==="success"&&(i(!1),Ge.success(u.message),t&&t())}).catch(u=>{Ge.error("Failed to delete Campaign",{description:u.message||"An unexpected error occurred"})}).finally(()=>{o(!1)})}catch{o(!1),Ge.error("Failed to delete Campaign")}};return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(G,{variant:"ghost",size:"icon",className:"h-8 w-8",asChild:!0,children:h.jsxs(Ot,{to:`/campaign/edit/${e.original.id}`,children:[h.jsx(hi,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Edit"})]})}),h.jsx(G,{variant:"ghost",size:"icon",className:"h-8 w-8",children:h.jsxs(Ot,{to:`/campaign/new/${e.original.id}`,children:[h.jsx(mi,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Clone"})]})}),h.jsxs(G,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>i(!0),children:[h.jsx(gi,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Delete"})]}),h.jsx(ci,{isOpen:n,isDeleting:r,itemType:"Campaign",itemName:`Campaign "${e.original.name}"`,onClose:()=>i(!1),onDelete:()=>a(e.original.id)})]})}const hr=(e,t)=>{if(typeof e=="number"){if(t===3)return{mode:"rgb",r:(e>>8&15|e>>4&240)/255,g:(e>>4&15|e&240)/255,b:(e&15|e<<4&240)/255};if(t===4)return{mode:"rgb",r:(e>>12&15|e>>8&240)/255,g:(e>>8&15|e>>4&240)/255,b:(e>>4&15|e&240)/255,alpha:(e&15|e<<4&240)/255};if(t===6)return{mode:"rgb",r:(e>>16&255)/255,g:(e>>8&255)/255,b:(e&255)/255};if(t===8)return{mode:"rgb",r:(e>>24&255)/255,g:(e>>16&255)/255,b:(e>>8&255)/255,alpha:(e&255)/255}}},_i={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ei=e=>hr(_i[e.toLowerCase()],6),Ri=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,Si=e=>{let t;return(t=e.match(Ri))?hr(parseInt(t[1],16),t[1].length):void 0},Z="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",Ne=`${Z}%`,Zt=`(?:${Z}%|${Z})`,Ii=`(?:${Z}(deg|grad|rad|turn)|${Z})`,ce="\\s*,\\s*",Pi=new RegExp(`^rgba?\\(\\s*${Z}${ce}${Z}${ce}${Z}\\s*(?:,\\s*${Zt}\\s*)?\\)$`),zi=new RegExp(`^rgba?\\(\\s*${Ne}${ce}${Ne}${ce}${Ne}\\s*(?:,\\s*${Zt}\\s*)?\\)$`),Bi=e=>{let t={mode:"rgb"},n;if(n=e.match(Pi))n[1]!==void 0&&(t.r=n[1]/255),n[2]!==void 0&&(t.g=n[2]/255),n[3]!==void 0&&(t.b=n[3]/255);else if(n=e.match(zi))n[1]!==void 0&&(t.r=n[1]/100),n[2]!==void 0&&(t.g=n[2]/100),n[3]!==void 0&&(t.b=n[3]/100);else return;return n[4]!==void 0?t.alpha=Math.max(0,Math.min(1,n[4]/100)):n[5]!==void 0&&(t.alpha=Math.max(0,Math.min(1,+n[5]))),t},ji=(e,t)=>e===void 0?void 0:typeof e!="object"?Vi(e):e.mode!==void 0?e:t?{...e,mode:t}:void 0,gr=(e="rgb")=>t=>(t=ji(t,e))!==void 0?t.mode===e?t:O[t.mode][e]?O[t.mode][e](t):e==="rgb"?O[t.mode].rgb(t):O.rgb[e](O[t.mode].rgb(t)):void 0,O={},mr={},ze=[],pr={},Ai=e=>e,B=e=>(O[e.mode]={...O[e.mode],...e.toMode},Object.keys(e.fromMode||{}).forEach(t=>{O[t]||(O[t]={}),O[t][e.mode]=e.fromMode[t]}),e.ranges||(e.ranges={}),e.difference||(e.difference={}),e.channels.forEach(t=>{if(e.ranges[t]===void 0&&(e.ranges[t]=[0,1]),!e.interpolate[t])throw new Error(`Missing interpolator for: ${t}`);typeof e.interpolate[t]=="function"&&(e.interpolate[t]={use:e.interpolate[t]}),e.interpolate[t].fixup||(e.interpolate[t].fixup=Ai)}),mr[e.mode]=e,(e.parse||[]).forEach(t=>{Di(t,e.mode)}),gr(e.mode)),Li=e=>mr[e],Di=(e,t)=>{if(typeof e=="string"){if(!t)throw new Error("'mode' required when 'parser' is a string");pr[e]=t}else typeof e=="function"&&ze.indexOf(e)<0&&ze.push(e)},Vt=/[^\x00-\x7F]|[a-zA-Z_]/,$i=/[^\x00-\x7F]|[-\w]/,c={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"};let I=0;function Se(e){let t=e[I],n=e[I+1];return t==="-"||t==="+"?/\d/.test(n)||n==="."&&/\d/.test(e[I+2]):t==="."?/\d/.test(n):/\d/.test(t)}function Xt(e){if(I>=e.length)return!1;let t=e[I];if(Vt.test(t))return!0;if(t==="-"){if(e.length-I<2)return!1;let n=e[I+1];return!!(n==="-"||Vt.test(n))}return!1}const qi={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function Ce(e){let t="";if((e[I]==="-"||e[I]==="+")&&(t+=e[I++]),t+=Ie(e),e[I]==="."&&/\d/.test(e[I+1])&&(t+=e[I++]+Ie(e)),(e[I]==="e"||e[I]==="E")&&((e[I+1]==="-"||e[I+1]==="+")&&/\d/.test(e[I+2])?t+=e[I++]+e[I++]+Ie(e):/\d/.test(e[I+1])&&(t+=e[I++]+Ie(e))),Xt(e)){let n=Be(e);return n==="deg"||n==="rad"||n==="turn"||n==="grad"?{type:c.Hue,value:t*qi[n]}:void 0}return e[I]==="%"?(I++,{type:c.Percentage,value:+t}):{type:c.Number,value:+t}}function Ie(e){let t="";for(;/\d/.test(e[I]);)t+=e[I++];return t}function Be(e){let t="";for(;I<e.length&&$i.test(e[I]);)t+=e[I++];return t}function Fi(e){let t=Be(e);return e[I]==="("?(I++,{type:c.Function,value:t}):t==="none"?{type:c.None,value:void 0}:{type:c.Ident,value:t}}function Hi(e=""){let t=e.trim(),n=[],i;for(I=0;I<t.length;){if(i=t[I++],i===`
`||i==="	"||i===" "){for(;I<t.length&&(t[I]===`
`||t[I]==="	"||t[I]===" ");)I++;continue}if(i===",")return;if(i===")"){n.push({type:c.ParenClose});continue}if(i==="+"){if(I--,Se(t)){n.push(Ce(t));continue}return}if(i==="-"){if(I--,Se(t)){n.push(Ce(t));continue}if(Xt(t)){n.push({type:c.Ident,value:Be(t)});continue}return}if(i==="."){if(I--,Se(t)){n.push(Ce(t));continue}return}if(i==="/"){for(;I<t.length&&(t[I]===`
`||t[I]==="	"||t[I]===" ");)I++;let r;if(Se(t)&&(r=Ce(t),r.type!==c.Hue)){n.push({type:c.Alpha,value:r});continue}if(Xt(t)&&Be(t)==="none"){n.push({type:c.Alpha,value:{type:c.None,value:void 0}});continue}return}if(/\d/.test(i)){I--,n.push(Ce(t));continue}if(Vt.test(i)){I--,n.push(Fi(t));continue}return}return n}function Ui(e){e._i=0;let t=e[e._i++];if(!t||t.type!==c.Function||t.value!=="color"||(t=e[e._i++],t.type!==c.Ident))return;const n=pr[t.value];if(!n)return;const i={mode:n},r=br(e,!1);if(!r)return;const o=Li(n).channels;for(let a=0,s,l;a<o.length;a++)s=r[a],l=o[a],s.type!==c.None&&(i[l]=s.type===c.Number?s.value:s.value/100,l==="alpha"&&(i[l]=Math.max(0,Math.min(1,i[l]))));return i}function br(e,t){const n=[];let i;for(;e._i<e.length;){if(i=e[e._i++],i.type===c.None||i.type===c.Number||i.type===c.Alpha||i.type===c.Percentage||t&&i.type===c.Hue){n.push(i);continue}if(i.type===c.ParenClose){if(e._i<e.length)return;continue}return}if(!(n.length<3||n.length>4)){if(n.length===4){if(n[3].type!==c.Alpha)return;n[3]=n[3].value}return n.length===3&&n.push({type:c.None,value:void 0}),n.every(r=>r.type!==c.Alpha)?n:void 0}}function Oi(e,t){e._i=0;let n=e[e._i++];if(!n||n.type!==c.Function)return;let i=br(e,t);if(i)return i.unshift(n.value),i}const Vi=e=>{if(typeof e!="string")return;const t=Hi(e),n=t?Oi(t,!0):void 0;let i,r=0,o=ze.length;for(;r<o;)if((i=ze[r++](e,n))!==void 0)return i;return t?Ui(t):void 0};function Xi(e,t){if(!t||t[0]!=="rgb"&&t[0]!=="rgba")return;const n={mode:"rgb"},[,i,r,o,a]=t;if(!(i.type===c.Hue||r.type===c.Hue||o.type===c.Hue))return i.type!==c.None&&(n.r=i.type===c.Number?i.value/255:i.value/100),r.type!==c.None&&(n.g=r.type===c.Number?r.value/255:r.value/100),o.type!==c.None&&(n.b=o.type===c.Number?o.value/255:o.value/100),a.type!==c.None&&(n.alpha=Math.min(1,Math.max(0,a.type===c.Number?a.value:a.value/100))),n}const Ki=e=>e==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,Yi=(e,t,n)=>e+n*(t-e),Ji=e=>{let t=[];for(let n=0;n<e.length-1;n++){let i=e[n],r=e[n+1];i===void 0&&r===void 0?t.push(void 0):i!==void 0&&r!==void 0?t.push([i,r]):t.push(i!==void 0?[i,i]:[r,r])}return t},Qi=e=>t=>{let n=Ji(t);return i=>{let r=i*n.length,o=i>=1?n.length-1:Math.max(Math.floor(r),0),a=n[o];return a===void 0?void 0:e(a[0],a[1],r-o)}},p=Qi(Yi),L=e=>{let t=!1,n=e.map(i=>i!==void 0?(t=!0,i):1);return t?n:e},he={mode:"rgb",channels:["r","g","b","alpha"],parse:[Xi,Si,Bi,Ei,Ki,"srgb"],serialize:"srgb",interpolate:{r:p,g:p,b:p,alpha:{use:p,fixup:L}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},Ze=(e=0)=>Math.pow(Math.abs(e),563/256)*Math.sign(e),fn=e=>{let t=Ze(e.r),n=Ze(e.g),i=Ze(e.b),r={mode:"xyz65",x:.5766690429101305*t+.1855582379065463*n+.1882286462349947*i,y:.297344975250536*t+.6273635662554661*n+.0752914584939979*i,z:.0270313613864123*t+.0706888525358272*n+.9913375368376386*i};return e.alpha!==void 0&&(r.alpha=e.alpha),r},We=e=>Math.pow(Math.abs(e),256/563)*Math.sign(e),dn=({x:e,y:t,z:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r={mode:"a98",r:We(e*2.0415879038107465-t*.5650069742788597-.3447313507783297*n),g:We(e*-.9692436362808798+t*1.8759675015077206+.0415550574071756*n),b:We(e*.0134442806320312-t*.1183623922310184+1.0151749943912058*n)};return i!==void 0&&(r.alpha=i),r},et=(e=0)=>{const t=Math.abs(e);return t<=.04045?e/12.92:(Math.sign(e)||1)*Math.pow((t+.055)/1.055,2.4)},ge=({r:e,g:t,b:n,alpha:i})=>{let r={mode:"lrgb",r:et(e),g:et(t),b:et(n)};return i!==void 0&&(r.alpha=i),r},re=e=>{let{r:t,g:n,b:i,alpha:r}=ge(e),o={mode:"xyz65",x:.4123907992659593*t+.357584339383878*n+.1804807884018343*i,y:.2126390058715102*t+.715168678767756*n+.0721923153607337*i,z:.0193308187155918*t+.119194779794626*n+.9505321522496607*i};return r!==void 0&&(o.alpha=r),o},tt=(e=0)=>{const t=Math.abs(e);return t>.0031308?(Math.sign(e)||1)*(1.055*Math.pow(t,1/2.4)-.055):e*12.92},me=({r:e,g:t,b:n,alpha:i},r="rgb")=>{let o={mode:r,r:tt(e),g:tt(t),b:tt(n)};return i!==void 0&&(o.alpha=i),o},ie=({x:e,y:t,z:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=me({r:e*3.2409699419045226-t*1.537383177570094-.4986107602930034*n,g:e*-.9692436362808796+t*1.8759675015077204+.0415550574071756*n,b:e*.0556300796969936-t*.2039769588889765+1.0569715142428784*n});return i!==void 0&&(r.alpha=i),r},Gi={...he,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:e=>dn(re(e)),xyz65:dn},toMode:{rgb:e=>ie(fn(e)),xyz65:fn}},$=e=>(e=e%360)<0?e+360:e,Zi=(e,t)=>e.map((n,i,r)=>{if(n===void 0)return n;let o=$(n);return i===0||e[i-1]===void 0?o:t(o-$(r[i-1]))}).reduce((n,i)=>!n.length||i===void 0||n[n.length-1]===void 0?(n.push(i),n):(n.push(i+n[n.length-1]),n),[]),K=e=>Zi(e,t=>Math.abs(t)<=180?t:t-360*Math.sign(t)),D=[-.14861,1.78277,-.29227,-.90649,1.97294,0],Wi=Math.PI/180,eo=180/Math.PI;let cn=D[3]*D[4],hn=D[1]*D[4],gn=D[1]*D[2]-D[0]*D[3];const to=({r:e,g:t,b:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=(gn*n+e*cn-t*hn)/(gn+cn-hn),o=n-r,a=(D[4]*(t-r)-D[2]*o)/D[3],s={mode:"cubehelix",l:r,s:r===0||r===1?void 0:Math.sqrt(o*o+a*a)/(D[4]*r*(1-r))};return s.s&&(s.h=Math.atan2(a,o)*eo-120),i!==void 0&&(s.alpha=i),s},no=({h:e,s:t,l:n,alpha:i})=>{let r={mode:"rgb"};e=(e===void 0?0:e+120)*Wi,n===void 0&&(n=0);let o=t===void 0?0:t*n*(1-n),a=Math.cos(e),s=Math.sin(e);return r.r=n+o*(D[0]*a+D[1]*s),r.g=n+o*(D[2]*a+D[3]*s),r.b=n+o*(D[4]*a+D[5]*s),i!==void 0&&(r.alpha=i),r},$e=(e,t)=>{if(e.h===void 0||t.h===void 0||!e.s||!t.s)return 0;let n=$(e.h),i=$(t.h),r=Math.sin((i-n+360)/2*Math.PI/180);return 2*Math.sqrt(e.s*t.s)*r},ro=(e,t)=>{if(e.h===void 0||t.h===void 0)return 0;let n=$(e.h),i=$(t.h);return Math.abs(i-n)>180?n-(i-360*Math.sign(i-n)):i-n},qe=(e,t)=>{if(e.h===void 0||t.h===void 0||!e.c||!t.c)return 0;let n=$(e.h),i=$(t.h),r=Math.sin((i-n+360)/2*Math.PI/180);return 2*Math.sqrt(e.c*t.c)*r},Y=e=>{let t=e.reduce((i,r)=>{if(r!==void 0){let o=r*Math.PI/180;i.sin+=Math.sin(o),i.cos+=Math.cos(o)}return i},{sin:0,cos:0}),n=Math.atan2(t.sin,t.cos)*180/Math.PI;return n<0?360+n:n},io={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:to},toMode:{rgb:no},interpolate:{h:{use:p,fixup:K},s:p,l:p,alpha:{use:p,fixup:L}},difference:{h:$e},average:{h:Y}},W=({l:e,a:t,b:n,alpha:i},r="lch")=>{t===void 0&&(t=0),n===void 0&&(n=0);let o=Math.sqrt(t*t+n*n),a={mode:r,l:e,c:o};return o&&(a.h=$(Math.atan2(n,t)*180/Math.PI)),i!==void 0&&(a.alpha=i),a},ee=({l:e,c:t,h:n,alpha:i},r="lab")=>{n===void 0&&(n=0);let o={mode:r,l:e,a:t?t*Math.cos(n/180*Math.PI):0,b:t?t*Math.sin(n/180*Math.PI):0};return i!==void 0&&(o.alpha=i),o},yr=Math.pow(29,3)/Math.pow(3,3),xr=Math.pow(6,3)/Math.pow(29,3),A={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},de={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329};let nt=e=>Math.pow(e,3)>xr?Math.pow(e,3):(116*e-16)/yr;const Mr=({l:e,a:t,b:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=(e+16)/116,o=t/500+r,a=r-n/200,s={mode:"xyz65",x:nt(o)*de.X,y:nt(r)*de.Y,z:nt(a)*de.Z};return i!==void 0&&(s.alpha=i),s},Fe=e=>ie(Mr(e)),rt=e=>e>xr?Math.cbrt(e):(yr*e+16)/116,wr=({x:e,y:t,z:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=rt(e/de.X),o=rt(t/de.Y),a=rt(n/de.Z),s={mode:"lab65",l:116*o-16,a:500*(r-o),b:200*(o-a)};return i!==void 0&&(s.alpha=i),s},He=e=>{let t=wr(re(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},je=1,vr=1,Te=26/180*Math.PI,Ae=Math.cos(Te),Le=Math.sin(Te),Cr=100/Math.log(139/100),Kt=({l:e,c:t,h:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r={mode:"lab65",l:(Math.exp(e*je/Cr)-1)/.0039},o=(Math.exp(.0435*t*vr*je)-1)/.075,a=o*Math.cos(n/180*Math.PI-Te),s=o*Math.sin(n/180*Math.PI-Te);return r.a=a*Ae-s/.83*Le,r.b=a*Le+s/.83*Ae,i!==void 0&&(r.alpha=i),r},Yt=({l:e,a:t,b:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=t*Ae+n*Le,o=.83*(n*Ae-t*Le),a=Math.sqrt(r*r+o*o),s={mode:"dlch",l:Cr/je*Math.log(1+.0039*e),c:Math.log(1+.075*a)/(.0435*vr*je)};return s.c&&(s.h=$((Math.atan2(o,r)+Te)/Math.PI*180)),i!==void 0&&(s.alpha=i),s},mn=e=>Kt(W(e,"dlch")),pn=e=>ee(Yt(e),"dlab"),oo={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:mn,rgb:e=>Fe(mn(e))},fromMode:{lab65:pn,rgb:e=>pn(He(e))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:p,a:p,b:p,alpha:{use:p,fixup:L}}},ao={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:Kt,dlab:e=>ee(e,"dlab"),rgb:e=>Fe(Kt(e))},fromMode:{lab65:Yt,dlab:e=>W(e,"dlch"),rgb:e=>Yt(He(e))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:p,c:p,h:{use:p,fixup:K},alpha:{use:p,fixup:L}},difference:{h:qe},average:{h:Y}};function so({h:e,s:t,i:n,alpha:i}){e=$(e!==void 0?e:0),t===void 0&&(t=0),n===void 0&&(n=0);let r=Math.abs(e/60%2-1),o;switch(Math.floor(e/60)){case 0:o={r:n*(1+t*(3/(2-r)-1)),g:n*(1+t*(3*(1-r)/(2-r)-1)),b:n*(1-t)};break;case 1:o={r:n*(1+t*(3*(1-r)/(2-r)-1)),g:n*(1+t*(3/(2-r)-1)),b:n*(1-t)};break;case 2:o={r:n*(1-t),g:n*(1+t*(3/(2-r)-1)),b:n*(1+t*(3*(1-r)/(2-r)-1))};break;case 3:o={r:n*(1-t),g:n*(1+t*(3*(1-r)/(2-r)-1)),b:n*(1+t*(3/(2-r)-1))};break;case 4:o={r:n*(1+t*(3*(1-r)/(2-r)-1)),g:n*(1-t),b:n*(1+t*(3/(2-r)-1))};break;case 5:o={r:n*(1+t*(3/(2-r)-1)),g:n*(1-t),b:n*(1+t*(3*(1-r)/(2-r)-1))};break;default:o={r:n*(1-t),g:n*(1-t),b:n*(1-t)}}return o.mode="rgb",i!==void 0&&(o.alpha=i),o}function lo({r:e,g:t,b:n,alpha:i}){e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=Math.max(e,t,n),o=Math.min(e,t,n),a={mode:"hsi",s:e+t+n===0?0:1-3*o/(e+t+n),i:(e+t+n)/3};return r-o!==0&&(a.h=(r===e?(t-n)/(r-o)+(t<n)*6:r===t?(n-e)/(r-o)+2:(e-t)/(r-o)+4)*60),i!==void 0&&(a.alpha=i),a}const uo={mode:"hsi",toMode:{rgb:so},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:lo},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:p,fixup:K},s:p,i:p,alpha:{use:p,fixup:L}},difference:{h:$e},average:{h:Y}};function fo({h:e,s:t,l:n,alpha:i}){e=$(e!==void 0?e:0),t===void 0&&(t=0),n===void 0&&(n=0);let r=n+t*(n<.5?n:1-n),o=r-(r-n)*2*Math.abs(e/60%2-1),a;switch(Math.floor(e/60)){case 0:a={r,g:o,b:2*n-r};break;case 1:a={r:o,g:r,b:2*n-r};break;case 2:a={r:2*n-r,g:r,b:o};break;case 3:a={r:2*n-r,g:o,b:r};break;case 4:a={r:o,g:2*n-r,b:r};break;case 5:a={r,g:2*n-r,b:o};break;default:a={r:2*n-r,g:2*n-r,b:2*n-r}}return a.mode="rgb",i!==void 0&&(a.alpha=i),a}function co({r:e,g:t,b:n,alpha:i}){e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=Math.max(e,t,n),o=Math.min(e,t,n),a={mode:"hsl",s:r===o?0:(r-o)/(1-Math.abs(r+o-1)),l:.5*(r+o)};return r-o!==0&&(a.h=(r===e?(t-n)/(r-o)+(t<n)*6:r===t?(n-e)/(r-o)+2:(e-t)/(r-o)+4)*60),i!==void 0&&(a.alpha=i),a}const ho=(e,t)=>{switch(t){case"deg":return+e;case"rad":return e/Math.PI*180;case"grad":return e/10*9;case"turn":return e*360}},go=new RegExp(`^hsla?\\(\\s*${Ii}${ce}${Ne}${ce}${Ne}\\s*(?:,\\s*${Zt}\\s*)?\\)$`),mo=e=>{let t=e.match(go);if(!t)return;let n={mode:"hsl"};return t[3]!==void 0?n.h=+t[3]:t[1]!==void 0&&t[2]!==void 0&&(n.h=ho(t[1],t[2])),t[4]!==void 0&&(n.s=Math.min(Math.max(0,t[4]/100),1)),t[5]!==void 0&&(n.l=Math.min(Math.max(0,t[5]/100),1)),t[6]!==void 0?n.alpha=Math.max(0,Math.min(1,t[6]/100)):t[7]!==void 0&&(n.alpha=Math.max(0,Math.min(1,+t[7]))),n};function po(e,t){if(!t||t[0]!=="hsl"&&t[0]!=="hsla")return;const n={mode:"hsl"},[,i,r,o,a]=t;if(i.type!==c.None){if(i.type===c.Percentage)return;n.h=i.value}if(r.type!==c.None){if(r.type===c.Hue)return;n.s=r.value/100}if(o.type!==c.None){if(o.type===c.Hue)return;n.l=o.value/100}return a.type!==c.None&&(n.alpha=Math.min(1,Math.max(0,a.type===c.Number?a.value:a.value/100))),n}const kr={mode:"hsl",toMode:{rgb:fo},fromMode:{rgb:co},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[po,mo],serialize:e=>`hsl(${e.h!==void 0?e.h:"none"} ${e.s!==void 0?e.s*100+"%":"none"} ${e.l!==void 0?e.l*100+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:p,fixup:K},s:p,l:p,alpha:{use:p,fixup:L}},difference:{h:$e},average:{h:Y}};function Nr({h:e,s:t,v:n,alpha:i}){e=$(e!==void 0?e:0),t===void 0&&(t=0),n===void 0&&(n=0);let r=Math.abs(e/60%2-1),o;switch(Math.floor(e/60)){case 0:o={r:n,g:n*(1-t*r),b:n*(1-t)};break;case 1:o={r:n*(1-t*r),g:n,b:n*(1-t)};break;case 2:o={r:n*(1-t),g:n,b:n*(1-t*r)};break;case 3:o={r:n*(1-t),g:n*(1-t*r),b:n};break;case 4:o={r:n*(1-t*r),g:n*(1-t),b:n};break;case 5:o={r:n,g:n*(1-t),b:n*(1-t*r)};break;default:o={r:n*(1-t),g:n*(1-t),b:n*(1-t)}}return o.mode="rgb",i!==void 0&&(o.alpha=i),o}function Tr({r:e,g:t,b:n,alpha:i}){e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=Math.max(e,t,n),o=Math.min(e,t,n),a={mode:"hsv",s:r===0?0:1-o/r,v:r};return r-o!==0&&(a.h=(r===e?(t-n)/(r-o)+(t<n)*6:r===t?(n-e)/(r-o)+2:(e-t)/(r-o)+4)*60),i!==void 0&&(a.alpha=i),a}const _r={mode:"hsv",toMode:{rgb:Nr},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:Tr},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:p,fixup:K},s:p,v:p,alpha:{use:p,fixup:L}},difference:{h:$e},average:{h:Y}};function bo({h:e,w:t,b:n,alpha:i}){if(t===void 0&&(t=0),n===void 0&&(n=0),t+n>1){let r=t+n;t/=r,n/=r}return Nr({h:e,s:n===1?1:1-t/(1-n),v:1-n,alpha:i})}function yo(e){let t=Tr(e);if(t===void 0)return;let n=t.s!==void 0?t.s:0,i=t.v!==void 0?t.v:0,r={mode:"hwb",w:(1-n)*i,b:1-i};return t.h!==void 0&&(r.h=t.h),t.alpha!==void 0&&(r.alpha=t.alpha),r}function xo(e,t){if(!t||t[0]!=="hwb")return;const n={mode:"hwb"},[,i,r,o,a]=t;if(i.type!==c.None){if(i.type===c.Percentage)return;n.h=i.value}if(r.type!==c.None){if(r.type===c.Hue)return;n.w=r.value/100}if(o.type!==c.None){if(o.type===c.Hue)return;n.b=o.value/100}return a.type!==c.None&&(n.alpha=Math.min(1,Math.max(0,a.type===c.Number?a.value:a.value/100))),n}const Mo={mode:"hwb",toMode:{rgb:bo},fromMode:{rgb:yo},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[xo],serialize:e=>`hwb(${e.h!==void 0?e.h:"none"} ${e.w!==void 0?e.w*100+"%":"none"} ${e.b!==void 0?e.b*100+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:p,fixup:K},w:p,b:p,alpha:{use:p,fixup:L}},difference:{h:ro},average:{h:Y}},Er=203,Ue=.1593017578125,Rr=78.84375,Oe=.8359375,Ve=18.8515625,Xe=18.6875;function it(e){if(e<0)return 0;const t=Math.pow(e,1/Rr);return 1e4*Math.pow(Math.max(0,t-Oe)/(Ve-Xe*t),1/Ue)}function ot(e){if(e<0)return 0;const t=Math.pow(e/1e4,Ue);return Math.pow((Oe+Ve*t)/(1+Xe*t),Rr)}const at=e=>Math.max(e/Er,0),bn=({i:e,t,p:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);const r=it(e+.008609037037932761*t+.11102962500302593*n),o=it(e-.00860903703793275*t-.11102962500302599*n),a=it(e+.5600313357106791*t-.32062717498731885*n),s={mode:"xyz65",x:at(2.070152218389422*r-1.3263473389671556*o+.2066510476294051*a),y:at(.3647385209748074*r+.680566024947227*o-.0453045459220346*a),z:at(-.049747207535812*r-.0492609666966138*o+1.1880659249923042*a)};return i!==void 0&&(s.alpha=i),s},st=(e=0)=>Math.max(e*Er,0),yn=({x:e,y:t,z:n,alpha:i})=>{const r=st(e),o=st(t),a=st(n),s=ot(.3592832590121217*r+.6976051147779502*o-.0358915932320289*a),l=ot(-.1920808463704995*r+1.1004767970374323*o+.0753748658519118*a),u=ot(.0070797844607477*r+.0748396662186366*o+.8433265453898765*a),f=.5*s+.5*l,g=1.61376953125*s-3.323486328125*l+1.709716796875*u,m=4.378173828125*s-4.24560546875*l-.132568359375*u,d={mode:"itp",i:f,t:g,p:m};return i!==void 0&&(d.alpha=i),d},wo={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:bn,rgb:e=>ie(bn(e))},fromMode:{xyz65:yn,rgb:e=>yn(re(e))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:p,t:p,p,alpha:{use:p,fixup:L}}},vo=134.03437499999998,Co=16295499532821565e-27,lt=e=>{if(e<0)return 0;let t=Math.pow(e/1e4,Ue);return Math.pow((Oe+Ve*t)/(1+Xe*t),vo)},ut=(e=0)=>Math.max(e*203,0),Sr=({x:e,y:t,z:n,alpha:i})=>{e=ut(e),t=ut(t),n=ut(n);let r=1.15*e-.15*n,o=.66*t+.34*e,a=lt(.41478972*r+.579999*o+.014648*n),s=lt(-.20151*r+1.120649*o+.0531008*n),l=lt(-.0166008*r+.2648*o+.6684799*n),u=(a+s)/2,f={mode:"jab",j:.44*u/(1-.56*u)-Co,a:3.524*a-4.066708*s+.542708*l,b:.199076*a+1.096799*s-1.295875*l};return i!==void 0&&(f.alpha=i),f},ko=134.03437499999998,xn=16295499532821565e-27,ft=e=>{if(e<0)return 0;let t=Math.pow(e,1/ko);return 1e4*Math.pow((Oe-t)/(Xe*t-Ve),1/Ue)},dt=e=>e/203,Ir=({j:e,a:t,b:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=(e+xn)/(.44+.56*(e+xn)),o=ft(r+.13860504*t+.058047316*n),a=ft(r-.13860504*t-.058047316*n),s=ft(r-.096019242*t-.8118919*n),l={mode:"xyz65",x:dt(1.661373024652174*o-.914523081304348*a+.23136208173913045*s),y:dt(-.3250758611844533*o+1.571847026732543*a-.21825383453227928*s),z:dt(-.090982811*o-.31272829*a+1.5227666*s)};return i!==void 0&&(l.alpha=i),l},Pr=e=>{let t=Sr(re(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},zr=e=>ie(Ir(e)),No={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:Pr,xyz65:Sr},toMode:{rgb:zr,xyz65:Ir},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:p,a:p,b:p,alpha:{use:p,fixup:L}}},Mn=({j:e,a:t,b:n,alpha:i})=>{t===void 0&&(t=0),n===void 0&&(n=0);let r=Math.sqrt(t*t+n*n),o={mode:"jch",j:e,c:r};return r&&(o.h=$(Math.atan2(n,t)*180/Math.PI)),i!==void 0&&(o.alpha=i),o},wn=({j:e,c:t,h:n,alpha:i})=>{n===void 0&&(n=0);let r={mode:"jab",j:e,a:t?t*Math.cos(n/180*Math.PI):0,b:t?t*Math.sin(n/180*Math.PI):0};return i!==void 0&&(r.alpha=i),r},To={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:wn,rgb:e=>zr(wn(e))},fromMode:{rgb:e=>Mn(Pr(e)),jab:Mn},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:p,fixup:K},c:p,j:p,alpha:{use:p,fixup:L}},difference:{h:qe},average:{h:Y}},Ke=Math.pow(29,3)/Math.pow(3,3),Wt=Math.pow(6,3)/Math.pow(29,3);let ct=e=>Math.pow(e,3)>Wt?Math.pow(e,3):(116*e-16)/Ke;const en=({l:e,a:t,b:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=(e+16)/116,o=t/500+r,a=r-n/200,s={mode:"xyz50",x:ct(o)*A.X,y:ct(r)*A.Y,z:ct(a)*A.Z};return i!==void 0&&(s.alpha=i),s},_e=({x:e,y:t,z:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=me({r:e*3.1341359569958707-t*1.6173863321612538-.4906619460083532*n,g:e*-.978795502912089+t*1.916254567259524+.03344273116131949*n,b:e*.07195537988411677-t*.2289768264158322+1.405386058324125*n});return i!==void 0&&(r.alpha=i),r},Br=e=>_e(en(e)),Ee=e=>{let{r:t,g:n,b:i,alpha:r}=ge(e),o={mode:"xyz50",x:.436065742824811*t+.3851514688337912*n+.14307845442264197*i,y:.22249319175623702*t+.7168870538238823*n+.06061979053616537*i,z:.013923904500943465*t+.09708128566574634*n+.7140993584005155*i};return r!==void 0&&(o.alpha=r),o},ht=e=>e>Wt?Math.cbrt(e):(Ke*e+16)/116,tn=({x:e,y:t,z:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=ht(e/A.X),o=ht(t/A.Y),a=ht(n/A.Z),s={mode:"lab",l:116*o-16,a:500*(r-o),b:200*(o-a)};return i!==void 0&&(s.alpha=i),s},jr=e=>{let t=tn(Ee(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t};function _o(e,t){if(!t||t[0]!=="lab")return;const n={mode:"lab"},[,i,r,o,a]=t;if(!(i.type===c.Hue||r.type===c.Hue||o.type===c.Hue))return i.type!==c.None&&(n.l=Math.min(Math.max(0,i.value),100)),r.type!==c.None&&(n.a=r.type===c.Number?r.value:r.value*125/100),o.type!==c.None&&(n.b=o.type===c.Number?o.value:o.value*125/100),a.type!==c.None&&(n.alpha=Math.min(1,Math.max(0,a.type===c.Number?a.value:a.value/100))),n}const nn={mode:"lab",toMode:{xyz50:en,rgb:Br},fromMode:{xyz50:tn,rgb:jr},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[_o],serialize:e=>`lab(${e.l!==void 0?e.l:"none"} ${e.a!==void 0?e.a:"none"} ${e.b!==void 0?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{l:p,a:p,b:p,alpha:{use:p,fixup:L}}},Eo={...nn,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:Mr,rgb:Fe},fromMode:{xyz65:wr,rgb:He},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}};function Ro(e,t){if(!t||t[0]!=="lch")return;const n={mode:"lch"},[,i,r,o,a]=t;if(i.type!==c.None){if(i.type===c.Hue)return;n.l=Math.min(Math.max(0,i.value),100)}if(r.type!==c.None&&(n.c=Math.max(0,r.type===c.Number?r.value:r.value*150/100)),o.type!==c.None){if(o.type===c.Percentage)return;n.h=o.value}return a.type!==c.None&&(n.alpha=Math.min(1,Math.max(0,a.type===c.Number?a.value:a.value/100))),n}const rn={mode:"lch",toMode:{lab:ee,rgb:e=>Br(ee(e))},fromMode:{rgb:e=>W(jr(e)),lab:W},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[Ro],serialize:e=>`lch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h!==void 0?e.h:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:p,fixup:K},c:p,l:p,alpha:{use:p,fixup:L}},difference:{h:qe},average:{h:Y}},So={...rn,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:e=>ee(e,"lab65"),rgb:e=>Fe(ee(e,"lab65"))},fromMode:{rgb:e=>W(He(e),"lch65"),lab65:e=>W(e,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},Ar=({l:e,u:t,v:n,alpha:i})=>{t===void 0&&(t=0),n===void 0&&(n=0);let r=Math.sqrt(t*t+n*n),o={mode:"lchuv",l:e,c:r};return r&&(o.h=$(Math.atan2(n,t)*180/Math.PI)),i!==void 0&&(o.alpha=i),o},Lr=({l:e,c:t,h:n,alpha:i})=>{n===void 0&&(n=0);let r={mode:"luv",l:e,u:t?t*Math.cos(n/180*Math.PI):0,v:t?t*Math.sin(n/180*Math.PI):0};return i!==void 0&&(r.alpha=i),r},Dr=(e,t,n)=>4*e/(e+15*t+3*n),$r=(e,t,n)=>9*t/(e+15*t+3*n),Io=Dr(A.X,A.Y,A.Z),Po=$r(A.X,A.Y,A.Z),zo=e=>e<=Wt?Ke*e:116*Math.cbrt(e)-16,Jt=({x:e,y:t,z:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=zo(t/A.Y),o=Dr(e,t,n),a=$r(e,t,n);!isFinite(o)||!isFinite(a)?r=o=a=0:(o=13*r*(o-Io),a=13*r*(a-Po));let s={mode:"luv",l:r,u:o,v:a};return i!==void 0&&(s.alpha=i),s},Bo=(e,t,n)=>4*e/(e+15*t+3*n),jo=(e,t,n)=>9*t/(e+15*t+3*n),Ao=Bo(A.X,A.Y,A.Z),Lo=jo(A.X,A.Y,A.Z),Qt=({l:e,u:t,v:n,alpha:i})=>{if(e===void 0&&(e=0),e===0)return{mode:"xyz50",x:0,y:0,z:0};t===void 0&&(t=0),n===void 0&&(n=0);let r=t/(13*e)+Ao,o=n/(13*e)+Lo,a=A.Y*(e<=8?e/Ke:Math.pow((e+16)/116,3)),s=a*(9*r)/(4*o),l=a*(12-3*r-20*o)/(4*o),u={mode:"xyz50",x:s,y:a,z:l};return i!==void 0&&(u.alpha=i),u},Do=e=>Ar(Jt(Ee(e))),$o=e=>_e(Qt(Lr(e))),qo={mode:"lchuv",toMode:{luv:Lr,rgb:$o},fromMode:{rgb:Do,luv:Ar},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:p,fixup:K},c:p,l:p,alpha:{use:p,fixup:L}},difference:{h:qe},average:{h:Y}},Fo={...he,mode:"lrgb",toMode:{rgb:me},fromMode:{rgb:ge},parse:["srgb-linear"],serialize:"srgb-linear"},Ho={mode:"luv",toMode:{xyz50:Qt,rgb:e=>_e(Qt(e))},fromMode:{xyz50:Jt,rgb:e=>Jt(Ee(e))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:p,u:p,v:p,alpha:{use:p,fixup:L}}},qr=({r:e,g:t,b:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=Math.cbrt(.412221469470763*e+.5363325372617348*t+.0514459932675022*n),o=Math.cbrt(.2119034958178252*e+.6806995506452344*t+.1073969535369406*n),a=Math.cbrt(.0883024591900564*e+.2817188391361215*t+.6299787016738222*n),s={mode:"oklab",l:.210454268309314*r+.7936177747023054*o-.0040720430116193*a,a:1.9779985324311684*r-2.42859224204858*o+.450593709617411*a,b:.0259040424655478*r+.7827717124575296*o-.8086757549230774*a};return i!==void 0&&(s.alpha=i),s},Ye=e=>{let t=qr(ge(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},Re=({l:e,a:t,b:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=Math.pow(e+.3963377773761749*t+.2158037573099136*n,3),o=Math.pow(e-.1055613458156586*t-.0638541728258133*n,3),a=Math.pow(e-.0894841775298119*t-1.2914855480194092*n,3),s={mode:"lrgb",r:4.076741636075957*r-3.3077115392580616*o+.2309699031821044*a,g:-1.2684379732850317*r+2.6097573492876887*o-.3413193760026573*a,b:-.0041960761386756*r-.7034186179359362*o+1.7076146940746117*a};return i!==void 0&&(s.alpha=i),s},Je=e=>me(Re(e));function Gt(e){const i=1.170873786407767;return .5*(i*e-.206+Math.sqrt((i*e-.206)*(i*e-.206)+4*.03*i*e))}function De(e){return(e*e+.206*e)/(1.170873786407767*(e+.03))}function Uo(e,t){let n,i,r,o,a,s,l,u;-1.88170328*e-.80936493*t>1?(n=1.19086277,i=1.76576728,r=.59662641,o=.75515197,a=.56771245,s=4.0767416621,l=-3.3077115913,u=.2309699292):1.81444104*e-1.19445276*t>1?(n=.73956515,i=-.45954404,r=.08285427,o=.1254107,a=.14503204,s=-1.2684380046,l=2.6097574011,u=-.3413193965):(n=1.35733652,i=-.00915799,r=-1.1513021,o=-.50559606,a=.00692167,s=-.0041960863,l=-.7034186147,u=1.707614701);let f=n+i*e+r*t+o*e*e+a*e*t,g=.3963377774*e+.2158037573*t,m=-.1055613458*e-.0638541728*t,d=-.0894841775*e-1.291485548*t;{let b=1+f*g,y=1+f*m,z=1+f*d,w=b*b*b,C=y*y*y,k=z*z*z,T=3*g*b*b,j=3*m*y*y,M=3*d*z*z,_=6*g*g*b,N=6*m*m*y,x=6*d*d*z,S=s*w+l*C+u*k,v=s*T+l*j+u*M,E=s*_+l*N+u*x;f=f-S*v/(v*v-.5*S*E)}return f}function on(e,t){let n=Uo(e,t),i=Re({l:1,a:n*e,b:n*t}),r=Math.cbrt(1/Math.max(i.r,i.g,i.b)),o=r*n;return[r,o]}function Oo(e,t,n,i,r,o=null){o||(o=on(e,t));let a;if((n-r)*o[1]-(o[0]-r)*i<=0)a=o[1]*r/(i*o[0]+o[1]*(r-n));else{a=o[1]*(r-1)/(i*(o[0]-1)+o[1]*(r-n));{let s=n-r,l=i,u=.3963377774*e+.2158037573*t,f=-.1055613458*e-.0638541728*t,g=-.0894841775*e-1.291485548*t,m=s+l*u,d=s+l*f,b=s+l*g;{let y=r*(1-a)+a*n,z=a*i,w=y+z*u,C=y+z*f,k=y+z*g,T=w*w*w,j=C*C*C,M=k*k*k,_=3*m*w*w,N=3*d*C*C,x=3*b*k*k,S=6*m*m*w,v=6*d*d*C,E=6*b*b*k,R=4.0767416621*T-3.3077115913*j+.2309699292*M-1,P=4.0767416621*_-3.3077115913*N+.2309699292*x,H=4.0767416621*S-3.3077115913*v+.2309699292*E,J=P/(P*P-.5*R*H),pe=-R*J,be=-1.2684380046*T+2.6097574011*j-.3413193965*M-1,ye=-1.2684380046*_+2.6097574011*N-.3413193965*x,xe=-1.2684380046*S+2.6097574011*v-.3413193965*E,te=ye/(ye*ye-.5*be*xe),se=-be*te,le=-.0041960863*T-.7034186147*j+1.707614701*M-1,Me=-.0041960863*_-.7034186147*N+1.707614701*x,we=-.0041960863*S-.7034186147*v+1.707614701*E,ve=Me/(Me*Me-.5*le*we),q=-le*ve;pe=J>=0?pe:1e6,se=te>=0?se:1e6,q=ve>=0?q:1e6,a+=Math.min(pe,Math.min(se,q))}}}return a}function an(e,t,n=null){n||(n=on(e,t));let i=n[0],r=n[1];return[r/i,r/(1-i)]}function Fr(e,t,n){let i=on(t,n),r=Oo(t,n,e,1,e,i),o=an(t,n,i),a=.11516993+1/(7.4477897+4.1590124*n+t*(-2.19557347+1.75198401*n+t*(-2.13704948-10.02301043*n+t*(-4.24894561+5.38770819*n+4.69891013*t)))),s=.11239642+1/(1.6132032-.68124379*n+t*(.40370612+.90148123*n+t*(-.27087943+.6122399*n+t*(.00299215-.45399568*n-.14661872*t)))),l=r/Math.min(e*o[0],(1-e)*o[1]),u=e*a,f=(1-e)*s,g=.9*l*Math.sqrt(Math.sqrt(1/(1/(u*u*u*u)+1/(f*f*f*f))));return u=e*.4,f=(1-e)*.8,[Math.sqrt(1/(1/(u*u)+1/(f*f))),g,r]}function vn(e){const t=e.l!==void 0?e.l:0,n=e.a!==void 0?e.a:0,i=e.b!==void 0?e.b:0,r={mode:"okhsl",l:Gt(t)};e.alpha!==void 0&&(r.alpha=e.alpha);let o=Math.sqrt(n*n+i*i);if(!o)return r.s=0,r;let[a,s,l]=Fr(t,n/o,i/o),u;if(o<s){let f=0,g=.8*a,m=1-g/s;u=(o-f)/(g+m*(o-f))*.8}else{let f=s,g=.2*s*s*1.25*1.25/a,m=1-g/(l-s);u=.8+.2*((o-f)/(g+m*(o-f)))}return u&&(r.s=u,r.h=$(Math.atan2(i,n)*180/Math.PI)),r}function Cn(e){let t=e.h!==void 0?e.h:0,n=e.s!==void 0?e.s:0,i=e.l!==void 0?e.l:0;const r={mode:"oklab",l:De(i)};if(e.alpha!==void 0&&(r.alpha=e.alpha),!n||i===1)return r.a=r.b=0,r;let o=Math.cos(t/180*Math.PI),a=Math.sin(t/180*Math.PI),[s,l,u]=Fr(r.l,o,a),f,g,m,d;n<.8?(f=1.25*n,g=0,m=.8*s,d=1-m/l):(f=5*(n-.8),g=l,m=.2*l*l*1.25*1.25/s,d=1-m/(u-l));let b=g+f*m/(1-d*f);return r.a=b*o,r.b=b*a,r}const Vo={...kr,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:vn,rgb:e=>vn(Ye(e))},toMode:{oklab:Cn,rgb:e=>Je(Cn(e))}};function kn(e){let t=e.l!==void 0?e.l:0,n=e.a!==void 0?e.a:0,i=e.b!==void 0?e.b:0,r=Math.sqrt(n*n+i*i),o=r?n/r:1,a=r?i/r:1,[s,l]=an(o,a),u=.5,f=1-u/s,g=l/(r+t*l),m=g*t,d=g*r,b=De(m),y=d*b/m,z=Re({l:b,a:o*y,b:a*y}),w=Math.cbrt(1/Math.max(z.r,z.g,z.b,0));t=t/w,r=r/w*Gt(t)/t,t=Gt(t);const C={mode:"okhsv",s:r?(u+l)*d/(l*u+l*f*d):0,v:t?t/m:0};return C.s&&(C.h=$(Math.atan2(i,n)*180/Math.PI)),e.alpha!==void 0&&(C.alpha=e.alpha),C}function Nn(e){const t={mode:"oklab"};e.alpha!==void 0&&(t.alpha=e.alpha);const n=e.h!==void 0?e.h:0,i=e.s!==void 0?e.s:0,r=e.v!==void 0?e.v:0,o=Math.cos(n/180*Math.PI),a=Math.sin(n/180*Math.PI),[s,l]=an(o,a),u=.5,f=1-u/s,g=1-i*u/(u+l-l*f*i),m=i*l*u/(u+l-l*f*i),d=De(g),b=m*d/g,y=Re({l:d,a:o*b,b:a*b}),z=Math.cbrt(1/Math.max(y.r,y.g,y.b,0)),w=De(r*g),C=m*w/g;return t.l=w*z,t.a=C*o*z,t.b=C*a*z,t}const Xo={..._r,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:kn,rgb:e=>kn(Ye(e))},toMode:{oklab:Nn,rgb:e=>Je(Nn(e))}};function Ko(e,t){if(!t||t[0]!=="oklab")return;const n={mode:"oklab"},[,i,r,o,a]=t;if(!(i.type===c.Hue||r.type===c.Hue||o.type===c.Hue))return i.type!==c.None&&(n.l=Math.min(Math.max(0,i.type===c.Number?i.value:i.value/100),1)),r.type!==c.None&&(n.a=r.type===c.Number?r.value:r.value*.4/100),o.type!==c.None&&(n.b=o.type===c.Number?o.value:o.value*.4/100),a.type!==c.None&&(n.alpha=Math.min(1,Math.max(0,a.type===c.Number?a.value:a.value/100))),n}const Yo={...nn,mode:"oklab",toMode:{lrgb:Re,rgb:Je},fromMode:{lrgb:qr,rgb:Ye},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[Ko],serialize:e=>`oklab(${e.l!==void 0?e.l:"none"} ${e.a!==void 0?e.a:"none"} ${e.b!==void 0?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`};function Jo(e,t){if(!t||t[0]!=="oklch")return;const n={mode:"oklch"},[,i,r,o,a]=t;if(i.type!==c.None){if(i.type===c.Hue)return;n.l=Math.min(Math.max(0,i.type===c.Number?i.value:i.value/100),1)}if(r.type!==c.None&&(n.c=Math.max(0,r.type===c.Number?r.value:r.value*.4/100)),o.type!==c.None){if(o.type===c.Percentage)return;n.h=o.value}return a.type!==c.None&&(n.alpha=Math.min(1,Math.max(0,a.type===c.Number?a.value:a.value/100))),n}const Qo={...rn,mode:"oklch",toMode:{oklab:e=>ee(e,"oklab"),rgb:e=>Je(ee(e,"oklab"))},fromMode:{rgb:e=>W(Ye(e),"oklch"),oklab:e=>W(e,"oklch")},parse:[Jo],serialize:e=>`oklch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h!==void 0?e.h:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},Tn=e=>{let{r:t,g:n,b:i,alpha:r}=ge(e),o={mode:"xyz65",x:.486570948648216*t+.265667693169093*n+.1982172852343625*i,y:.2289745640697487*t+.6917385218365062*n+.079286914093745*i,z:0*t+.0451133818589026*n+1.043944368900976*i};return r!==void 0&&(o.alpha=r),o},_n=({x:e,y:t,z:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r=me({r:e*2.4934969119414263-t*.9313836179191242-.402710784450717*n,g:e*-.8294889695615749+t*1.7626640603183465+.0236246858419436*n,b:e*.0358458302437845-t*.0761723892680418+.9568845240076871*n},"p3");return i!==void 0&&(r.alpha=i),r},Go={...he,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:e=>_n(re(e)),xyz65:_n},toMode:{rgb:e=>ie(Tn(e)),xyz65:Tn}},gt=e=>{let t=Math.abs(e);return t>=1/512?Math.sign(e)*Math.pow(t,1/1.8):16*e},En=({x:e,y:t,z:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r={mode:"prophoto",r:gt(e*1.3457868816471585-t*.2555720873797946-.0511018649755453*n),g:gt(e*-.5446307051249019+t*1.5082477428451466+.0205274474364214*n),b:gt(e*0+t*0+1.2119675456389452*n)};return i!==void 0&&(r.alpha=i),r},mt=(e=0)=>{let t=Math.abs(e);return t>=16/512?Math.sign(e)*Math.pow(t,1.8):e/16},Rn=e=>{let t=mt(e.r),n=mt(e.g),i=mt(e.b),r={mode:"xyz50",x:.7977666449006423*t+.1351812974005331*n+.0313477341283922*i,y:.2880748288194013*t+.7118352342418731*n+899369387256e-16*i,z:0*t+0*n+.8251046025104602*i};return e.alpha!==void 0&&(r.alpha=e.alpha),r},Zo={...he,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:En,rgb:e=>En(Ee(e))},toMode:{xyz50:Rn,rgb:e=>_e(Rn(e))}},Sn=1.09929682680944,Wo=.018053968510807,pt=e=>{const t=Math.abs(e);return t>Wo?(Math.sign(e)||1)*(Sn*Math.pow(t,.45)-(Sn-1)):4.5*e},In=({x:e,y:t,z:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);let r={mode:"rec2020",r:pt(e*1.7166511879712683-t*.3556707837763925-.2533662813736599*n),g:pt(e*-.6666843518324893+t*1.6164812366349395+.0157685458139111*n),b:pt(e*.0176398574453108-t*.0427706132578085+.9421031212354739*n)};return i!==void 0&&(r.alpha=i),r},Pn=1.09929682680944,ea=.018053968510807,bt=(e=0)=>{let t=Math.abs(e);return t<ea*4.5?e/4.5:(Math.sign(e)||1)*Math.pow((t+Pn-1)/Pn,1/.45)},zn=e=>{let t=bt(e.r),n=bt(e.g),i=bt(e.b),r={mode:"xyz65",x:.6369580483012911*t+.1446169035862083*n+.1688809751641721*i,y:.262700212011267*t+.6779980715188708*n+.059301716469862*i,z:0*t+.0280726930490874*n+1.0609850577107909*i};return e.alpha!==void 0&&(r.alpha=e.alpha),r},ta={...he,mode:"rec2020",fromMode:{xyz65:In,rgb:e=>In(re(e))},toMode:{xyz65:zn,rgb:e=>ie(zn(e))},parse:["rec2020"],serialize:"rec2020"},ne=.0037930732552754493,Hr=Math.cbrt(ne),yt=e=>Math.cbrt(e)-Hr,na=e=>{const{r:t,g:n,b:i,alpha:r}=ge(e),o=yt(.3*t+.622*n+.078*i+ne),a=yt(.23*t+.692*n+.078*i+ne),s=yt(.2434226892454782*t+.2047674442449682*n+.5518098665095535*i+ne),l={mode:"xyb",x:(o-a)/2,y:(o+a)/2,b:s-(o+a)/2};return r!==void 0&&(l.alpha=r),l},xt=e=>Math.pow(e+Hr,3),ra=({x:e,y:t,b:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);const r=xt(e+t)-ne,o=xt(t-e)-ne,a=xt(n+t)-ne,s=me({r:11.031566904639861*r-9.866943908131562*o-.16462299650829934*a,g:-3.2541473810744237*r+4.418770377582723*o-.16462299650829934*a,b:-3.6588512867136815*r+2.7129230459360922*o+1.9459282407775895*a});return i!==void 0&&(s.alpha=i),s},ia={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:ra},fromMode:{rgb:na},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:p,y:p,b:p,alpha:{use:p,fixup:L}}},oa={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:_e,lab:tn},fromMode:{rgb:Ee,lab:en},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:p,y:p,z:p,alpha:{use:p,fixup:L}}},aa=e=>{let{x:t,y:n,z:i,alpha:r}=e;t===void 0&&(t=0),n===void 0&&(n=0),i===void 0&&(i=0);let o={mode:"xyz50",x:1.0479298208405488*t+.0229467933410191*n-.0501922295431356*i,y:.0296278156881593*t+.990434484573249*n-.0170738250293851*i,z:-.0092430581525912*t+.0150551448965779*n+.7518742899580008*i};return r!==void 0&&(o.alpha=r),o},sa=e=>{let{x:t,y:n,z:i,alpha:r}=e;t===void 0&&(t=0),n===void 0&&(n=0),i===void 0&&(i=0);let o={mode:"xyz65",x:.9554734527042182*t-.0230985368742614*n+.0632593086610217*i,y:-.0283697069632081*t+1.0099954580058226*n+.021041398966943*i,z:.0123140016883199*t-.0205076964334779*n+1.3303659366080753*i};return r!==void 0&&(o.alpha=r),o},la={mode:"xyz65",toMode:{rgb:ie,xyz50:aa},fromMode:{rgb:re,xyz50:sa},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:p,y:p,z:p,alpha:{use:p,fixup:L}}},ua=({r:e,g:t,b:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);const r={mode:"yiq",y:.29889531*e+.58662247*t+.11448223*n,i:.59597799*e-.2741761*t-.32180189*n,q:.21147017*e-.52261711*t+.31114694*n};return i!==void 0&&(r.alpha=i),r},fa=({y:e,i:t,q:n,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=0);const r={mode:"rgb",r:e+.95608445*t+.6208885*n,g:e-.27137664*t-.6486059*n,b:e-1.10561724*t+1.70250126*n};return i!==void 0&&(r.alpha=i),r},da={mode:"yiq",toMode:{rgb:fa},fromMode:{rgb:ua},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:p,i:p,q:p,alpha:{use:p,fixup:L}}},ca=e=>Math.max(0,Math.min(1,e||0)),Mt=e=>Math.round(ca(e)*255),ha=gr("rgb"),ga=e=>{if(e===void 0)return;let t=Mt(e.r),n=Mt(e.g),i=Mt(e.b);return"#"+(1<<24|t<<16|n<<8|i).toString(16).slice(1)},Bn=e=>ga(ha(e));B(Gi);B(io);B(oo);B(ao);B(uo);B(kr);B(_r);B(Mo);B(wo);B(No);B(To);B(nn);B(Eo);B(rn);B(So);B(qo);B(Fo);B(Ho);B(Vo);B(Xo);B(Yo);const jn=B(Qo);B(Go);B(Zo);B(ta);B(he);B(ia);B(oa);B(la);B(da);var fe={},wt,An;function ma(){return An||(An=1,wt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),wt}var vt={},Q={},Ln;function oe(){if(Ln)return Q;Ln=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Q.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},Q.getSymbolTotalCodewords=function(i){return t[i]},Q.getBCHDigit=function(n){let i=0;for(;n!==0;)i++,n>>>=1;return i},Q.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');e=i},Q.isKanjiModeEnabled=function(){return typeof e<"u"},Q.toSJIS=function(i){return e(i)},Q}var Ct={},Dn;function sn(){return Dn||(Dn=1,function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},e.from=function(i,r){if(e.isValid(i))return i;try{return t(i)}catch{return r}}}(Ct)),Ct}var kt,$n;function pa(){if($n)return kt;$n=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let i=0;i<n;i++)this.putBit((t>>>n-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},kt=e,kt}var Nt,qn;function ba(){if(qn)return Nt;qn=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,n,i,r){const o=t*this.size+n;this.data[o]=i,r&&(this.reservedBit[o]=!0)},e.prototype.get=function(t,n){return this.data[t*this.size+n]},e.prototype.xor=function(t,n,i){this.data[t*this.size+n]^=i},e.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]},Nt=e,Nt}var Tt={},Fn;function ya(){return Fn||(Fn=1,function(e){const t=oe().getSymbolSize;e.getRowColCoords=function(i){if(i===1)return[];const r=Math.floor(i/7)+2,o=t(i),a=o===145?26:Math.ceil((o-13)/(2*r-2))*2,s=[o-7];for(let l=1;l<r-1;l++)s[l]=s[l-1]-a;return s.push(6),s.reverse()},e.getPositions=function(i){const r=[],o=e.getRowColCoords(i),a=o.length;for(let s=0;s<a;s++)for(let l=0;l<a;l++)s===0&&l===0||s===0&&l===a-1||s===a-1&&l===0||r.push([o[s],o[l]]);return r}}(Tt)),Tt}var _t={},Hn;function xa(){if(Hn)return _t;Hn=1;const e=oe().getSymbolSize,t=7;return _t.getPositions=function(i){const r=e(i);return[[0,0],[r-t,0],[0,r-t]]},_t}var Et={},Un;function Ma(){return Un||(Un=1,function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(r){return r!=null&&r!==""&&!isNaN(r)&&r>=0&&r<=7},e.from=function(r){return e.isValid(r)?parseInt(r,10):void 0},e.getPenaltyN1=function(r){const o=r.size;let a=0,s=0,l=0,u=null,f=null;for(let g=0;g<o;g++){s=l=0,u=f=null;for(let m=0;m<o;m++){let d=r.get(g,m);d===u?s++:(s>=5&&(a+=t.N1+(s-5)),u=d,s=1),d=r.get(m,g),d===f?l++:(l>=5&&(a+=t.N1+(l-5)),f=d,l=1)}s>=5&&(a+=t.N1+(s-5)),l>=5&&(a+=t.N1+(l-5))}return a},e.getPenaltyN2=function(r){const o=r.size;let a=0;for(let s=0;s<o-1;s++)for(let l=0;l<o-1;l++){const u=r.get(s,l)+r.get(s,l+1)+r.get(s+1,l)+r.get(s+1,l+1);(u===4||u===0)&&a++}return a*t.N2},e.getPenaltyN3=function(r){const o=r.size;let a=0,s=0,l=0;for(let u=0;u<o;u++){s=l=0;for(let f=0;f<o;f++)s=s<<1&2047|r.get(u,f),f>=10&&(s===1488||s===93)&&a++,l=l<<1&2047|r.get(f,u),f>=10&&(l===1488||l===93)&&a++}return a*t.N3},e.getPenaltyN4=function(r){let o=0;const a=r.data.length;for(let l=0;l<a;l++)o+=r.data[l];return Math.abs(Math.ceil(o*100/a/5)-10)*t.N4};function n(i,r,o){switch(i){case e.Patterns.PATTERN000:return(r+o)%2===0;case e.Patterns.PATTERN001:return r%2===0;case e.Patterns.PATTERN010:return o%3===0;case e.Patterns.PATTERN011:return(r+o)%3===0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(o/3))%2===0;case e.Patterns.PATTERN101:return r*o%2+r*o%3===0;case e.Patterns.PATTERN110:return(r*o%2+r*o%3)%2===0;case e.Patterns.PATTERN111:return(r*o%3+(r+o)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}e.applyMask=function(r,o){const a=o.size;for(let s=0;s<a;s++)for(let l=0;l<a;l++)o.isReserved(l,s)||o.xor(l,s,n(r,l,s))},e.getBestMask=function(r,o){const a=Object.keys(e.Patterns).length;let s=0,l=1/0;for(let u=0;u<a;u++){o(u),e.applyMask(u,r);const f=e.getPenaltyN1(r)+e.getPenaltyN2(r)+e.getPenaltyN3(r)+e.getPenaltyN4(r);e.applyMask(u,r),f<l&&(l=f,s=u)}return s}}(Et)),Et}var Pe={},On;function Ur(){if(On)return Pe;On=1;const e=sn(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Pe.getBlocksCount=function(r,o){switch(o){case e.L:return t[(r-1)*4+0];case e.M:return t[(r-1)*4+1];case e.Q:return t[(r-1)*4+2];case e.H:return t[(r-1)*4+3];default:return}},Pe.getTotalCodewordsCount=function(r,o){switch(o){case e.L:return n[(r-1)*4+0];case e.M:return n[(r-1)*4+1];case e.Q:return n[(r-1)*4+2];case e.H:return n[(r-1)*4+3];default:return}},Pe}var Rt={},ke={},Vn;function wa(){if(Vn)return ke;Vn=1;const e=new Uint8Array(512),t=new Uint8Array(256);return function(){let i=1;for(let r=0;r<255;r++)e[r]=i,t[i]=r,i<<=1,i&256&&(i^=285);for(let r=255;r<512;r++)e[r]=e[r-255]}(),ke.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},ke.exp=function(i){return e[i]},ke.mul=function(i,r){return i===0||r===0?0:e[t[i]+t[r]]},ke}var Xn;function va(){return Xn||(Xn=1,function(e){const t=wa();e.mul=function(i,r){const o=new Uint8Array(i.length+r.length-1);for(let a=0;a<i.length;a++)for(let s=0;s<r.length;s++)o[a+s]^=t.mul(i[a],r[s]);return o},e.mod=function(i,r){let o=new Uint8Array(i);for(;o.length-r.length>=0;){const a=o[0];for(let l=0;l<r.length;l++)o[l]^=t.mul(r[l],a);let s=0;for(;s<o.length&&o[s]===0;)s++;o=o.slice(s)}return o},e.generateECPolynomial=function(i){let r=new Uint8Array([1]);for(let o=0;o<i;o++)r=e.mul(r,new Uint8Array([1,t.exp(o)]));return r}}(Rt)),Rt}var St,Kn;function Ca(){if(Kn)return St;Kn=1;const e=va();function t(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(i){this.degree=i,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const r=new Uint8Array(i.length+this.degree);r.set(i);const o=e.mod(r,this.genPoly),a=this.degree-o.length;if(a>0){const s=new Uint8Array(this.degree);return s.set(o,a),s}return o},St=t,St}var It={},Pt={},zt={},Yn;function Or(){return Yn||(Yn=1,zt.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),zt}var U={},Jn;function Vr(){if(Jn)return U;Jn=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r
]))+`;U.KANJI=new RegExp(n,"g"),U.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),U.BYTE=new RegExp(i,"g"),U.NUMERIC=new RegExp(e,"g"),U.ALPHANUMERIC=new RegExp(t,"g");const r=new RegExp("^"+n+"$"),o=new RegExp("^"+e+"$"),a=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return U.testKanji=function(l){return r.test(l)},U.testNumeric=function(l){return o.test(l)},U.testAlphanumeric=function(l){return a.test(l)},U}var Qn;function ae(){return Qn||(Qn=1,function(e){const t=Or(),n=Vr();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(o,a){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!t.isValid(a))throw new Error("Invalid version: "+a);return a>=1&&a<10?o.ccBits[0]:a<27?o.ccBits[1]:o.ccBits[2]},e.getBestModeForData=function(o){return n.testNumeric(o)?e.NUMERIC:n.testAlphanumeric(o)?e.ALPHANUMERIC:n.testKanji(o)?e.KANJI:e.BYTE},e.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},e.isValid=function(o){return o&&o.bit&&o.ccBits};function i(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+r)}}e.from=function(o,a){if(e.isValid(o))return o;try{return i(o)}catch{return a}}}(Pt)),Pt}var Gn;function ka(){return Gn||(Gn=1,function(e){const t=oe(),n=Ur(),i=sn(),r=ae(),o=Or(),a=7973,s=t.getBCHDigit(a);function l(m,d,b){for(let y=1;y<=40;y++)if(d<=e.getCapacity(y,b,m))return y}function u(m,d){return r.getCharCountIndicator(m,d)+4}function f(m,d){let b=0;return m.forEach(function(y){const z=u(y.mode,d);b+=z+y.getBitsLength()}),b}function g(m,d){for(let b=1;b<=40;b++)if(f(m,b)<=e.getCapacity(b,d,r.MIXED))return b}e.from=function(d,b){return o.isValid(d)?parseInt(d,10):b},e.getCapacity=function(d,b,y){if(!o.isValid(d))throw new Error("Invalid QR Code version");typeof y>"u"&&(y=r.BYTE);const z=t.getSymbolTotalCodewords(d),w=n.getTotalCodewordsCount(d,b),C=(z-w)*8;if(y===r.MIXED)return C;const k=C-u(y,d);switch(y){case r.NUMERIC:return Math.floor(k/10*3);case r.ALPHANUMERIC:return Math.floor(k/11*2);case r.KANJI:return Math.floor(k/13);case r.BYTE:default:return Math.floor(k/8)}},e.getBestVersionForData=function(d,b){let y;const z=i.from(b,i.M);if(Array.isArray(d)){if(d.length>1)return g(d,z);if(d.length===0)return 1;y=d[0]}else y=d;return l(y.mode,y.getLength(),z)},e.getEncodedBits=function(d){if(!o.isValid(d)||d<7)throw new Error("Invalid QR Code version");let b=d<<12;for(;t.getBCHDigit(b)-s>=0;)b^=a<<t.getBCHDigit(b)-s;return d<<12|b}}(It)),It}var Bt={},Zn;function Na(){if(Zn)return Bt;Zn=1;const e=oe(),t=1335,n=21522,i=e.getBCHDigit(t);return Bt.getEncodedBits=function(o,a){const s=o.bit<<3|a;let l=s<<10;for(;e.getBCHDigit(l)-i>=0;)l^=t<<e.getBCHDigit(l)-i;return(s<<10|l)^n},Bt}var jt={},At,Wn;function Ta(){if(Wn)return At;Wn=1;const e=ae();function t(n){this.mode=e.NUMERIC,this.data=n.toString()}return t.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(i){let r,o,a;for(r=0;r+3<=this.data.length;r+=3)o=this.data.substr(r,3),a=parseInt(o,10),i.put(a,10);const s=this.data.length-r;s>0&&(o=this.data.substr(r),a=parseInt(o,10),i.put(a,s*3+1))},At=t,At}var Lt,er;function _a(){if(er)return Lt;er=1;const e=ae(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n(i){this.mode=e.ALPHANUMERIC,this.data=i}return n.getBitsLength=function(r){return 11*Math.floor(r/2)+6*(r%2)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){let o;for(o=0;o+2<=this.data.length;o+=2){let a=t.indexOf(this.data[o])*45;a+=t.indexOf(this.data[o+1]),r.put(a,11)}this.data.length%2&&r.put(t.indexOf(this.data[o]),6)},Lt=n,Lt}var Dt,tr;function Ea(){if(tr)return Dt;tr=1;const e=ae();function t(n){this.mode=e.BYTE,typeof n=="string"?this.data=new TextEncoder().encode(n):this.data=new Uint8Array(n)}return t.getBitsLength=function(i){return i*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){for(let i=0,r=this.data.length;i<r;i++)n.put(this.data[i],8)},Dt=t,Dt}var $t,nr;function Ra(){if(nr)return $t;nr=1;const e=ae(),t=oe();function n(i){this.mode=e.KANJI,this.data=i}return n.getBitsLength=function(r){return r*13},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(i){let r;for(r=0;r<this.data.length;r++){let o=t.toSJIS(this.data[r]);if(o>=33088&&o<=40956)o-=33088;else if(o>=57408&&o<=60351)o-=49472;else throw new Error("Invalid SJIS character: "+this.data[r]+`
Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),i.put(o,13)}},$t=n,$t}var qt={exports:{}},rr;function Sa(){return rr||(rr=1,function(e){var t={single_source_shortest_paths:function(n,i,r){var o={},a={};a[i]=0;var s=t.PriorityQueue.make();s.push(i,0);for(var l,u,f,g,m,d,b,y,z;!s.empty();){l=s.pop(),u=l.value,g=l.cost,m=n[u]||{};for(f in m)m.hasOwnProperty(f)&&(d=m[f],b=g+d,y=a[f],z=typeof a[f]>"u",(z||y>b)&&(a[f]=b,s.push(f,b),o[f]=u))}if(typeof r<"u"&&typeof a[r]>"u"){var w=["Could not find a path from ",i," to ",r,"."].join("");throw new Error(w)}return o},extract_shortest_path_from_predecessor_list:function(n,i){for(var r=[],o=i;o;)r.push(o),n[o],o=n[o];return r.reverse(),r},find_path:function(n,i,r){var o=t.single_source_shortest_paths(n,i,r);return t.extract_shortest_path_from_predecessor_list(o,r)},PriorityQueue:{make:function(n){var i=t.PriorityQueue,r={},o;n=n||{};for(o in i)i.hasOwnProperty(o)&&(r[o]=i[o]);return r.queue=[],r.sorter=n.sorter||i.default_sorter,r},default_sorter:function(n,i){return n.cost-i.cost},push:function(n,i){var r={value:n,cost:i};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t}(qt)),qt.exports}var ir;function Ia(){return ir||(ir=1,function(e){const t=ae(),n=Ta(),i=_a(),r=Ea(),o=Ra(),a=Vr(),s=oe(),l=Sa();function u(w){return unescape(encodeURIComponent(w)).length}function f(w,C,k){const T=[];let j;for(;(j=w.exec(k))!==null;)T.push({data:j[0],index:j.index,mode:C,length:j[0].length});return T}function g(w){const C=f(a.NUMERIC,t.NUMERIC,w),k=f(a.ALPHANUMERIC,t.ALPHANUMERIC,w);let T,j;return s.isKanjiModeEnabled()?(T=f(a.BYTE,t.BYTE,w),j=f(a.KANJI,t.KANJI,w)):(T=f(a.BYTE_KANJI,t.BYTE,w),j=[]),C.concat(k,T,j).sort(function(_,N){return _.index-N.index}).map(function(_){return{data:_.data,mode:_.mode,length:_.length}})}function m(w,C){switch(C){case t.NUMERIC:return n.getBitsLength(w);case t.ALPHANUMERIC:return i.getBitsLength(w);case t.KANJI:return o.getBitsLength(w);case t.BYTE:return r.getBitsLength(w)}}function d(w){return w.reduce(function(C,k){const T=C.length-1>=0?C[C.length-1]:null;return T&&T.mode===k.mode?(C[C.length-1].data+=k.data,C):(C.push(k),C)},[])}function b(w){const C=[];for(let k=0;k<w.length;k++){const T=w[k];switch(T.mode){case t.NUMERIC:C.push([T,{data:T.data,mode:t.ALPHANUMERIC,length:T.length},{data:T.data,mode:t.BYTE,length:T.length}]);break;case t.ALPHANUMERIC:C.push([T,{data:T.data,mode:t.BYTE,length:T.length}]);break;case t.KANJI:C.push([T,{data:T.data,mode:t.BYTE,length:u(T.data)}]);break;case t.BYTE:C.push([{data:T.data,mode:t.BYTE,length:u(T.data)}])}}return C}function y(w,C){const k={},T={start:{}};let j=["start"];for(let M=0;M<w.length;M++){const _=w[M],N=[];for(let x=0;x<_.length;x++){const S=_[x],v=""+M+x;N.push(v),k[v]={node:S,lastCount:0},T[v]={};for(let E=0;E<j.length;E++){const R=j[E];k[R]&&k[R].node.mode===S.mode?(T[R][v]=m(k[R].lastCount+S.length,S.mode)-m(k[R].lastCount,S.mode),k[R].lastCount+=S.length):(k[R]&&(k[R].lastCount=S.length),T[R][v]=m(S.length,S.mode)+4+t.getCharCountIndicator(S.mode,C))}}j=N}for(let M=0;M<j.length;M++)T[j[M]].end=0;return{map:T,table:k}}function z(w,C){let k;const T=t.getBestModeForData(w);if(k=t.from(C,T),k!==t.BYTE&&k.bit<T.bit)throw new Error('"'+w+'" cannot be encoded with mode '+t.toString(k)+`.
 Suggested mode is: `+t.toString(T));switch(k===t.KANJI&&!s.isKanjiModeEnabled()&&(k=t.BYTE),k){case t.NUMERIC:return new n(w);case t.ALPHANUMERIC:return new i(w);case t.KANJI:return new o(w);case t.BYTE:return new r(w)}}e.fromArray=function(C){return C.reduce(function(k,T){return typeof T=="string"?k.push(z(T,null)):T.data&&k.push(z(T.data,T.mode)),k},[])},e.fromString=function(C,k){const T=g(C,s.isKanjiModeEnabled()),j=b(T),M=y(j,k),_=l.find_path(M.map,"start","end"),N=[];for(let x=1;x<_.length-1;x++)N.push(M.table[_[x]].node);return e.fromArray(d(N))},e.rawSplit=function(C){return e.fromArray(g(C,s.isKanjiModeEnabled()))}}(jt)),jt}var or;function Pa(){if(or)return vt;or=1;const e=oe(),t=sn(),n=pa(),i=ba(),r=ya(),o=xa(),a=Ma(),s=Ur(),l=Ca(),u=ka(),f=Na(),g=ae(),m=Ia();function d(M,_){const N=M.size,x=o.getPositions(_);for(let S=0;S<x.length;S++){const v=x[S][0],E=x[S][1];for(let R=-1;R<=7;R++)if(!(v+R<=-1||N<=v+R))for(let P=-1;P<=7;P++)E+P<=-1||N<=E+P||(R>=0&&R<=6&&(P===0||P===6)||P>=0&&P<=6&&(R===0||R===6)||R>=2&&R<=4&&P>=2&&P<=4?M.set(v+R,E+P,!0,!0):M.set(v+R,E+P,!1,!0))}}function b(M){const _=M.size;for(let N=8;N<_-8;N++){const x=N%2===0;M.set(N,6,x,!0),M.set(6,N,x,!0)}}function y(M,_){const N=r.getPositions(_);for(let x=0;x<N.length;x++){const S=N[x][0],v=N[x][1];for(let E=-2;E<=2;E++)for(let R=-2;R<=2;R++)E===-2||E===2||R===-2||R===2||E===0&&R===0?M.set(S+E,v+R,!0,!0):M.set(S+E,v+R,!1,!0)}}function z(M,_){const N=M.size,x=u.getEncodedBits(_);let S,v,E;for(let R=0;R<18;R++)S=Math.floor(R/3),v=R%3+N-8-3,E=(x>>R&1)===1,M.set(S,v,E,!0),M.set(v,S,E,!0)}function w(M,_,N){const x=M.size,S=f.getEncodedBits(_,N);let v,E;for(v=0;v<15;v++)E=(S>>v&1)===1,v<6?M.set(v,8,E,!0):v<8?M.set(v+1,8,E,!0):M.set(x-15+v,8,E,!0),v<8?M.set(8,x-v-1,E,!0):v<9?M.set(8,15-v-1+1,E,!0):M.set(8,15-v-1,E,!0);M.set(x-8,8,1,!0)}function C(M,_){const N=M.size;let x=-1,S=N-1,v=7,E=0;for(let R=N-1;R>0;R-=2)for(R===6&&R--;;){for(let P=0;P<2;P++)if(!M.isReserved(S,R-P)){let H=!1;E<_.length&&(H=(_[E]>>>v&1)===1),M.set(S,R-P,H),v--,v===-1&&(E++,v=7)}if(S+=x,S<0||N<=S){S-=x,x=-x;break}}}function k(M,_,N){const x=new n;N.forEach(function(P){x.put(P.mode.bit,4),x.put(P.getLength(),g.getCharCountIndicator(P.mode,M)),P.write(x)});const S=e.getSymbolTotalCodewords(M),v=s.getTotalCodewordsCount(M,_),E=(S-v)*8;for(x.getLengthInBits()+4<=E&&x.put(0,4);x.getLengthInBits()%8!==0;)x.putBit(0);const R=(E-x.getLengthInBits())/8;for(let P=0;P<R;P++)x.put(P%2?17:236,8);return T(x,M,_)}function T(M,_,N){const x=e.getSymbolTotalCodewords(_),S=s.getTotalCodewordsCount(_,N),v=x-S,E=s.getBlocksCount(_,N),R=x%E,P=E-R,H=Math.floor(x/E),J=Math.floor(v/E),pe=J+1,be=H-J,ye=new l(be);let xe=0;const te=new Array(E),se=new Array(E);let le=0;const Me=new Uint8Array(M.buffer);for(let ue=0;ue<E;ue++){const Qe=ue<P?J:pe;te[ue]=Me.slice(xe,xe+Qe),se[ue]=ye.encode(te[ue]),xe+=Qe,le=Math.max(le,Qe)}const we=new Uint8Array(x);let ve=0,q,V;for(q=0;q<le;q++)for(V=0;V<E;V++)q<te[V].length&&(we[ve++]=te[V][q]);for(q=0;q<be;q++)for(V=0;V<E;V++)we[ve++]=se[V][q];return we}function j(M,_,N,x){let S;if(Array.isArray(M))S=m.fromArray(M);else if(typeof M=="string"){let H=_;if(!H){const J=m.rawSplit(M);H=u.getBestVersionForData(J,N)}S=m.fromString(M,H||40)}else throw new Error("Invalid data");const v=u.getBestVersionForData(S,N);if(!v)throw new Error("The amount of data is too big to be stored in a QR Code");if(!_)_=v;else if(_<v)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+v+`.
`);const E=k(_,N,S),R=e.getSymbolSize(_),P=new i(R);return d(P,_),b(P),y(P,_),w(P,N,0),_>=7&&z(P,_),C(P,E),isNaN(x)&&(x=a.getBestMask(P,w.bind(null,P,N))),a.applyMask(x,P),w(P,N,x),{modules:P,version:_,errorCorrectionLevel:N,maskPattern:x,segments:S}}return vt.create=function(_,N){if(typeof _>"u"||_==="")throw new Error("No input text");let x=t.M,S,v;return typeof N<"u"&&(x=t.from(N.errorCorrectionLevel,t.M),S=u.from(N.version),v=a.from(N.maskPattern),N.toSJISFunc&&e.setToSJISFunction(N.toSJISFunc)),j(_,S,x,v)},vt}var Ft={},Ht={},ar;function Xr(){return ar||(ar=1,function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let i=n.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+n);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(o){return[o,o]}))),i.length===6&&i.push("F","F");const r=parseInt(i.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+i.slice(0,6).join("")}}e.getOptions=function(i){i||(i={}),i.color||(i.color={});const r=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,o=i.width&&i.width>=21?i.width:void 0,a=i.scale||4;return{width:o,scale:o?4:a,margin:r,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},e.getScale=function(i,r){return r.width&&r.width>=i+r.margin*2?r.width/(i+r.margin*2):r.scale},e.getImageWidth=function(i,r){const o=e.getScale(i,r);return Math.floor((i+r.margin*2)*o)},e.qrToImageData=function(i,r,o){const a=r.modules.size,s=r.modules.data,l=e.getScale(a,o),u=Math.floor((a+o.margin*2)*l),f=o.margin*l,g=[o.color.light,o.color.dark];for(let m=0;m<u;m++)for(let d=0;d<u;d++){let b=(m*u+d)*4,y=o.color.light;if(m>=f&&d>=f&&m<u-f&&d<u-f){const z=Math.floor((m-f)/l),w=Math.floor((d-f)/l);y=g[s[z*a+w]?1:0]}i[b++]=y.r,i[b++]=y.g,i[b++]=y.b,i[b]=y.a}}}(Ht)),Ht}var sr;function za(){return sr||(sr=1,function(e){const t=Xr();function n(r,o,a){r.clearRect(0,0,o.width,o.height),o.style||(o.style={}),o.height=a,o.width=a,o.style.height=a+"px",o.style.width=a+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(o,a,s){let l=s,u=a;typeof l>"u"&&(!a||!a.getContext)&&(l=a,a=void 0),a||(u=i()),l=t.getOptions(l);const f=t.getImageWidth(o.modules.size,l),g=u.getContext("2d"),m=g.createImageData(f,f);return t.qrToImageData(m.data,o,l),n(g,u,f),g.putImageData(m,0,0),u},e.renderToDataURL=function(o,a,s){let l=s;typeof l>"u"&&(!a||!a.getContext)&&(l=a,a=void 0),l||(l={});const u=e.render(o,a,l),f=l.type||"image/png",g=l.rendererOpts||{};return u.toDataURL(f,g.quality)}}(Ft)),Ft}var Ut={},lr;function Ba(){if(lr)return Ut;lr=1;const e=Xr();function t(r,o){const a=r.a/255,s=o+'="'+r.hex+'"';return a<1?s+" "+o+'-opacity="'+a.toFixed(2).slice(1)+'"':s}function n(r,o,a){let s=r+o;return typeof a<"u"&&(s+=" "+a),s}function i(r,o,a){let s="",l=0,u=!1,f=0;for(let g=0;g<r.length;g++){const m=Math.floor(g%o),d=Math.floor(g/o);!m&&!u&&(u=!0),r[g]?(f++,g>0&&m>0&&r[g-1]||(s+=u?n("M",m+a,.5+d+a):n("m",l,0),l=0,u=!1),m+1<o&&r[g+1]||(s+=n("h",f),f=0)):l++}return s}return Ut.render=function(o,a,s){const l=e.getOptions(a),u=o.modules.size,f=o.modules.data,g=u+l.margin*2,m=l.color.light.a?"<path "+t(l.color.light,"fill")+' d="M0 0h'+g+"v"+g+'H0z"/>':"",d="<path "+t(l.color.dark,"stroke")+' d="'+i(f,u,l.margin)+'"/>',b='viewBox="0 0 '+g+" "+g+'"',z='<svg xmlns="http://www.w3.org/2000/svg" '+(l.width?'width="'+l.width+'" height="'+l.width+'" ':"")+b+' shape-rendering="crispEdges">'+m+d+`</svg>
`;return typeof s=="function"&&s(null,z),z},Ut}var ur;function ja(){if(ur)return fe;ur=1;const e=ma(),t=Pa(),n=za(),i=Ba();function r(o,a,s,l,u){const f=[].slice.call(arguments,1),g=f.length,m=typeof f[g-1]=="function";if(!m&&!e())throw new Error("Callback required as last argument");if(m){if(g<2)throw new Error("Too few arguments provided");g===2?(u=s,s=a,a=l=void 0):g===3&&(a.getContext&&typeof u>"u"?(u=l,l=void 0):(u=l,l=s,s=a,a=void 0))}else{if(g<1)throw new Error("Too few arguments provided");return g===1?(s=a,a=l=void 0):g===2&&!a.getContext&&(l=s,s=a,a=void 0),new Promise(function(d,b){try{const y=t.create(s,l);d(o(y,a,l))}catch(y){b(y)}})}try{const d=t.create(s,l);u(null,o(d,a,l))}catch(d){u(d)}}return fe.create=t.create,fe.toCanvas=r.bind(null,n.render),fe.toDataURL=r.bind(null,n.renderToDataURL),fe.toString=r.bind(null,function(o,a,s){return i.render(o,s)}),fe}var Aa=ja();const La=Jr(Aa),Da=/oklch\(([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)\)/,fr=(e,t)=>{const n=e.match(Da);return n?{l:Number.parseFloat(n[1]),c:Number.parseFloat(n[2]),h:Number.parseFloat(n[3])}:{l:t[0],c:t[1],h:t[2]}},$a=({data:e,foreground:t,background:n,robustness:i="M",className:r,...o})=>{const[a,s]=F.useState(null);return F.useEffect(()=>{(async()=>{try{const u=getComputedStyle(document.documentElement),f=t??u.getPropertyValue("--foreground"),g=n??u.getPropertyValue("--background"),m=fr(f,[.21,.006,285.885]),d=fr(g,[.985,0,0]),b=await La.toString(e,{type:"svg",color:{dark:Bn(jn({mode:"oklch",...m})),light:Bn(jn({mode:"oklch",...d}))},width:200,errorCorrectionLevel:i,margin:0});s(b)}catch(u){console.error(u)}})()},[e,t,n,i]),a?h.jsx("div",{className:Qr("size-full","[&_svg]:size-full",r),dangerouslySetInnerHTML:{__html:a},...o}):null};function qa({url:e}){const[t,n]=F.useState(!1),i=F.useRef(null),r=()=>{if(!i.current)return;const o=i.current.querySelector("svg");if(!o)return;const s=new XMLSerializer().serializeToString(o),l=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),u=URL.createObjectURL(l),f=new Image;f.onload=()=>{const g=document.createElement("canvas");g.width=f.width,g.height=f.height,g.getContext("2d").drawImage(f,0,0),URL.revokeObjectURL(u),g.toBlob(d=>{const b=URL.createObjectURL(d),y=document.createElement("a");y.href=b,y.download=`qr-code-${Date.now()}.png`,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(b)},"image/png")},f.src=u};return h.jsxs(h.Fragment,{children:[h.jsx(G,{variant:"outline",size:"sm",onClick:()=>n(!0),children:h.jsx(vi,{className:"w-4 h-4"})}),h.jsx(pi,{open:t,onOpenChange:n,children:h.jsxs(bi,{className:"max-w-sm",children:[h.jsxs(yi,{children:[h.jsx(xi,{className:"text-center",children:"QR Code"}),h.jsx(Mi,{className:"text-center",children:"Scan this QR code to access the link"})]}),h.jsxs("div",{className:"flex flex-col items-center gap-6 py-4",children:[h.jsx("div",{ref:i,className:"p-4 bg-white rounded-lg border-2 border-gray-200",children:h.jsx($a,{data:e})}),h.jsx("div",{className:"flex gap-2 w-full",children:h.jsxs(G,{onClick:r,className:"flex-1",size:"lg",children:[h.jsx(wi,{className:"w-4 h-4 mr-2"}),"Download QR Code"]})})]})]})})]})}const Fa=({onRefresh:e})=>[{id:"select",header:({table:t})=>h.jsx(un,{checked:t.getIsAllPageRowsSelected()||t.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:n=>t.toggleAllPageRowsSelected(!!n),"aria-label":"Select all"}),cell:({row:t})=>h.jsx(un,{checked:t.getIsSelected(),onCheckedChange:n=>t.toggleSelected(!!n),"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1},{accessorKey:"id",header:({column:t})=>h.jsx(X,{column:t,title:"ID"}),cell:({row:t})=>h.jsx("div",{className:"w-[20px]",children:t.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:t})=>h.jsx(X,{column:t,title:"Name"}),cell:({row:t})=>h.jsx("div",{className:"w-fit",children:t.getValue("name")}),enableSorting:!1,enableHiding:!1},{accessorKey:"category_name",header:({column:t})=>h.jsx(X,{column:t,title:"Category"}),cell:({row:t})=>h.jsx("div",{className:"w-fit",children:t.getValue("category_name")}),enableSorting:!1,enableHiding:!1},{accessorKey:"slug",header:({column:t})=>h.jsx(X,{column:t,title:"Short Link"}),cell:({row:t})=>{const n=t.getValue("slug");if(!n)return h.jsx("div",{className:"text-muted-foreground",children:"-"});const i=window.location.origin,r=n.startsWith("http")?n:`${i.replace(/\/wp-admin\/?$/,"")}/${n.replace(/^\/+/,"")}`;return h.jsxs("div",{className:"flex items-center gap-2 w-[300px] border border-gray-200 rounded-md px-2 py-1 hover:shadow-sm transition-shadow",children:[h.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline flex-1",title:r,children:r}),h.jsx("button",{onClick:()=>ln(r,"Link copied to clipboard!"),className:"flex items-center justify-center p-1 rounded-md hover:bg-muted transition-colors",title:"Copy link",children:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4 text-muted-foreground",children:[h.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),h.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),h.jsx(qa,{url:r})]})},enableSorting:!1,enableHiding:!1},{accessorKey:"target_url",header:({column:t})=>h.jsx(X,{column:t,title:"Target Url"}),cell:({row:t})=>h.jsxs("div",{className:"flex items-center gap-2 w-[300px] border border-gray-200 rounded-md px-2 py-1 hover:shadow-sm transition-shadow",children:[h.jsx("a",{href:t.getValue("target_url"),target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline flex-1",title:t.getValue("target_url"),children:t.getValue("target_url")}),h.jsx("button",{onClick:()=>ln(t.getValue("target_url"),"Link copied to clipboard!"),className:"flex items-center justify-center p-1 rounded-md hover:bg-muted transition-colors",title:"Copy link",children:h.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4 text-muted-foreground",children:[h.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),h.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),enableSorting:!1,enableHiding:!1},{accessorKey:"total_clicks",header:({column:t})=>h.jsx(X,{column:t,title:"Clicks"}),cell:({row:t})=>{const n=t.getValue("total_clicks");return h.jsx("div",{className:"flex w-[100px] items-center text-center",children:n})}},{accessorKey:"status",header:({column:t})=>h.jsx(X,{column:t,title:"Status"}),cell:({row:t})=>{const n=t.getValue("status");return h.jsx("div",{className:"flex w-[100px] items-center",children:h.jsx(di,{variant:n==="active"?"default":"destructive",children:n==="active"?"Active":"Inactive"})})}},{accessorKey:"created_at",header:({column:t})=>h.jsx(X,{column:t,title:"Created At"}),cell:({row:t})=>h.jsx("div",{className:"w-fit",children:t.getValue("created_at")}),enableSorting:!1,enableHiding:!0},{id:"actions",header:({column:t})=>h.jsx(X,{column:t,title:"Actions"}),cell:({row:t})=>h.jsx(Ti,{row:t,onRefresh:e})}];function d0(){const[e,t]=F.useState(()=>{const d=new Date,b=new Date(d);return b.setDate(d.getDate()-7),{dateFrom:b.toISOString().slice(0,10),dateTo:d.toISOString().slice(0,10)}}),[n,i]=F.useState([]),[r,o]=F.useState(!0),{openModal:a}=Gr.getState(),s=(linkfiliate==null?void 0:linkfiliate.is_free)==="1"||(linkfiliate==null?void 0:linkfiliate.is_free)===1||(linkfiliate==null?void 0:linkfiliate.is_free)===!0,l=new cr(linkfiliate==null?void 0:linkfiliate.pluginApiUrl,linkfiliate==null?void 0:linkfiliate.nonce),u=s&&n.length>=1,f=async()=>{try{o(!0);const d=await l.get(`/campaigns?from=${e.dateFrom}&to=${e.dateTo}`);i(d.data||[])}catch(d){console.error("Error fetching campaigns:",d)}finally{o(!1)}};F.useEffect(()=>{document.title=`Campaigns | ${linkfiliate==null?void 0:linkfiliate.pluginName}`,f()},[]),F.useEffect(()=>{f()},[e.dateFrom,e.dateTo]);const g=d=>{var k,T;const b=(k=d==null?void 0:d.range)==null?void 0:k.from,y=(T=d==null?void 0:d.range)==null?void 0:T.to;if(!b||!y)return;const z=Math.floor((y-b)/(1e3*60*60*24)),w=b.toISOString().slice(0,10),C=y.toISOString().slice(0,10);if(z>14){a(!0);return}t({dateFrom:w,dateTo:C}),setLoading(!0)},m=[{name:"Dashboard",href:"#/dashboard"},{name:"Campaigns"}];return h.jsx(Zr,{breadcrumb:m,toolbarRight:h.jsx(G,{asChild:!0,disabled:u,children:h.jsx(Ot,{to:"/campaign/new",children:"+ Create Campaign"})}),children:h.jsx("div",{className:"space-y-6",children:h.jsx("div",{className:"p-4",children:h.jsx(fi,{data:n,columns:Fa({onRefresh:f}),toolbar:d=>h.jsx(Ni,{table:d,children:h.jsx(Wr,{onUpdate:g,initialDateFrom:e.dateFrom,initialDateTo:e.dateTo,align:"start",locale:"en-GB",showCompare:!1})}),isLoading:r})})})})}export{d0 as default};
//# sourceMappingURL=index-CiC8O8SM.js.map
