Changeset 3751624
- Timestamp:
- 10/17/2026 08:14:32 AM (4 weeks ago)
- Location:
- bubuku-media-library
- Files:
-
- 2 added
- 16 edited
- 1 copied
-
tags/1.4.3 (copied) (copied from bubuku-media-library/trunk )
-
tags/1.4.3/assets/build/admin.asset.php (modified) (1 diff)
-
tags/1.4.3/assets/build/admin.js (modified) (1 diff)
-
tags/1.4.3/assets/build/style-admin.css (modified) (1 diff)
-
tags/1.4.3/bubuku-media-library.php (modified) (1 diff)
-
tags/1.4.3/includes/tools/class-tool-import-attachments-alt.php (modified) (3 diffs)
-
tags/1.4.3/readme.txt (modified) (2 diffs)
-
tags/1.4.3/src/BML_Alt_Importer.php (added)
-
tags/1.4.3/src/BML_Plugin.php (modified) (1 diff)
-
tags/1.4.3/src/BML_Restapi.php (modified) (3 diffs)
-
trunk/assets/build/admin.asset.php (modified) (1 diff)
-
trunk/assets/build/admin.js (modified) (1 diff)
-
trunk/assets/build/style-admin.css (modified) (1 diff)
-
trunk/bubuku-media-library.php (modified) (1 diff)
-
trunk/includes/tools/class-tool-import-attachments-alt.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/BML_Alt_Importer.php (added)
-
trunk/src/BML_Plugin.php (modified) (1 diff)
-
trunk/src/BML_Restapi.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bubuku-media-library/tags/1.4.3/assets/build/admin.asset.php
r3741020 r3751624 1 <?php return array('dependencies' => array('react', 'wp-element', 'wp-i18n'), 'version' => ' a914bef940db55f8dd3a');1 <?php return array('dependencies' => array('react', 'wp-element', 'wp-i18n'), 'version' => '84752ece8d6b773f404e'); -
bubuku-media-library/tags/1.4.3/assets/build/admin.js
r3741020 r3751624 1 (()=>{var e,t={980(e,t,a){"use strict";const r=window.React,i=window.wp.element,n=window.wp.i18n,l=function(){return(0,r.createElement)("div",{className:"bk-header-main"},(0,r.createElement)("div",{className:"bk-icon"},(0,r.createElement)("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},(0,r.createElement)("rect",{x:"16",y:"16",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeOpacity:"0.85",strokeWidth:"1.8",fill:"currentColor",fillOpacity:"0.1"}),(0,r.createElement)("circle",{cx:"20",cy:"20",r:"1.5",stroke:"currentColor",strokeOpacity:"0.85",strokeWidth:"1.5",fill:"none"}),(0,r.createElement)("polyline",{points:"34 28 30 23 21 34",stroke:"currentColor",strokeOpacity:"0.85",strokeWidth:"1.8"}),(0,r.createElement)("circle",{cx:"11",cy:"11",r:"8.5",stroke:"currentColor",strokeWidth:"2.5",fill:"currentColor",fillOpacity:"0.18"}),(0,r.createElement)("circle",{cx:"8.5",cy:"8.5",r:"2",stroke:"currentColor",strokeOpacity:"0.4",strokeWidth:"1",fill:"none"}),(0,r.createElement)("line",{x1:"4.5",y1:"17.5",x2:"1",y2:"21",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round"}))),(0,r.createElement)("div",null,(0,r.createElement)("p",{className:"bk-title"},(0,i.createInterpolateElement)((0,n.__)("Bubuku Media Library <span>Settings</span>","bubuku-media-library"),{span:(0,r.createElement)("span",null)})),(0,r.createElement)("p",{className:"bk-subtitle"},(0,n.__)("Manage and optimize your WordPress media library","bubuku-media-library"))))},s=({icon:e,iconVariant:t="icon-accent",title:a,claim:i,animationDelay:n,headerMeta:l=null,children:s})=>{const o=n?{animationDelay:n}:void 0;return(0,r.createElement)("div",{className:"bk-dashboard-card",style:o},(0,r.createElement)("div",{className:"card-header"},(0,r.createElement)("div",{className:"card-header-main"},(0,r.createElement)("div",{className:`card-header-icon ${t}`},e),(0,r.createElement)("div",{className:"card-header-text"},(0,r.createElement)("h2",null,a),(0,r.createElement)("p",null,i))),l&&(0,r.createElement)("div",{className:"card-header-meta"},l)),(0,r.createElement)("div",{className:"card-body"},s))},o=()=>(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),(0,r.createElement)("polyline",{points:"22,6 12,13 2,6"})),c=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),(0,r.createElement)("polyline",{points:"17 21 17 13 7 13 7 21"}),(0,r.createElement)("polyline",{points:"7 3 7 8 15 8"})),u=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),m=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.createElement)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),d=()=>(0,r.createElement)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.createElement)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,r.createElement)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})),b=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,r.createElement)("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})),h=({reportsEmails:e,reportsDisable:t})=>{const[a,l]=(0,i.useState)(""),[h,p]=(0,i.useState)(0),[k,_]=(0,i.useState)(!1),[f,g]=(0,i.useState)(""),[y,E]=(0,i.useState)(""),[v,w]=(0,i.useState)(""),[N,x]=(0,i.useState)(!1),[C,S]=(0,i.useState)(""),[L,z]=(0,i.useState)(""),[M,O]=(0,i.useState)(""),B=`${BbkMediaLibrary.api_url}/set-notification-settings`,A=`${BbkMediaLibrary.api_url}/set-reports-disable`,R=`${BbkMediaLibrary.api_url}/send-manual-report`,T=`${BbkMediaLibrary.api_url}/get-report-preview-url`,j=BbkMediaLibrary._wpnonce,W=BbkMediaLibrary.rest_nonce;return(0,i.useEffect)(()=>{l(null!=e?e:""),p(null!=t?t:0)},[t,e]),(0,i.useEffect)(()=>{fetch(T,{method:"GET",headers:{"X-WP-Nonce":W}}).then(e=>e.json()).then(e=>{e&&e.preview_url&&O(e.preview_url)}).catch(()=>{})},[T,W]),(0,r.createElement)(s,{icon:(0,r.createElement)(o,null),title:(0,n.__)("Email notifications","bubuku-media-library"),claim:(0,n.__)("Receive automatic reports in your inbox","bubuku-media-library")},(0,r.createElement)("form",{id:"bbk-email-notifications-form",onSubmit:e=>{e.preventDefault(),g(""),E("");const t=a.split(",");let r=!0;t.forEach(e=>{e.trim().match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)||(r=!1)}),r?(_(!0),fetch(B,{method:"POST",body:JSON.stringify({emails:a,_wpnonce:j}),headers:{"Content-Type":"application/json","X-WP-Nonce":W}}).then(e=>e.json()).then(e=>{_(!1),e.success?g((0,n.__)("Settings saved successfully","bubuku-media-library")):E((0,n.__)("Error saving settings","bubuku-media-library"))}).catch(()=>{_(!1),E((0,n.__)("Network error. Please try again.","bubuku-media-library"))})):E((0,n.__)("Invalid email format","bubuku-media-library"))},className:"bbk-email-notifications"},(0,r.createElement)("div",{className:"form-row"},(0,r.createElement)("div",{className:"form-row__label"},(0,r.createElement)("span",{className:"form-row__title"},(0,n.__)("Emails to notify","bubuku-media-library")),(0,r.createElement)("span",{className:"form-row__help"},(0,n.__)("Comma separated","bubuku-media-library"))),(0,r.createElement)("div",{className:"form-row__control"},(0,r.createElement)("input",{type:"text",name:"emails",id:"bbk-emails",value:a,onChange:e=>{l(e.target.value),g(""),E("")},disabled:k}))),(0,r.createElement)("div",{className:"form-row form-row--separated"},(0,r.createElement)("div",{className:"form-row__label"},(0,r.createElement)("span",{className:"form-row__title"},(0,n.__)("Weekly reports","bubuku-media-library")),(0,r.createElement)("span",{className:"form-row__help"},(0,n.__)("Sending frequency","bubuku-media-library"))),(0,r.createElement)("div",{className:"form-row__control"},(0,r.createElement)("select",{name:"disable_reports",id:"disable_reports",value:h,onChange:e=>{const t=parseInt(e.target.value,10);p(t),fetch(A,{method:"POST",body:JSON.stringify({disable_reports:t,_wpnonce:j}),headers:{"Content-Type":"application/json","X-WP-Nonce":W}}).then(e=>e.json()).catch(()=>{})}},(0,r.createElement)("option",{value:"0"},(0,n.__)("Disabled","bubuku-media-library")),(0,r.createElement)("option",{value:"1"},(0,n.__)("Weekly","bubuku-media-library")),(0,r.createElement)("option",{value:"2"},(0,n.__)("Monthly","bubuku-media-library")))))),(0,r.createElement)("div",{className:"bbk-email-hint"},(0,r.createElement)(d,null),(0,r.createElement)("p",null,(0,n.__)("You will receive an email report with the file sizes of your media library. Use it to identify heavy images, optimize your site’s performance, and improve your users’ experience.","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-send-test"},(0,r.createElement)("div",{className:"bbk-send-test__header"},(0,r.createElement)("span",{className:"bbk-send-test__title"},(0,n.__)("Send test report","bubuku-media-library")),(0,r.createElement)("span",{className:"bbk-send-test__help"},(0,n.__)("Send the report to one or more addresses right now","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-send-test__row"},(0,r.createElement)("input",{className:"bbk-send-test__input",type:"text",value:v,placeholder:"email@example.com",onChange:e=>{w(e.target.value),S(""),z("")},disabled:N}),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary",onClick:()=>{S(""),z("");const e=v.trim();if(!e)return;const t=e.split(",");let a=!0;t.forEach(e=>{e.trim().match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)||(a=!1)}),a?(x(!0),fetch(R,{method:"POST",body:JSON.stringify({emails:e}),headers:{"Content-Type":"application/json","X-WP-Nonce":W}}).then(e=>e.json()).then(e=>{x(!1),e.sent?(S((0,n.__)("Report sent successfully","bubuku-media-library")),w("")):z(e.message||(0,n.__)("Error sending the report","bubuku-media-library"))}).catch(()=>{x(!1),z((0,n.__)("Network error. Please try again.","bubuku-media-library"))})):z((0,n.__)("Invalid email format","bubuku-media-library"))},disabled:N||!v.trim()},(0,r.createElement)(b,null),N?(0,n.__)("Sending…","bubuku-media-library"):(0,n.__)("Send now","bubuku-media-library"))),(C||L)&&(0,r.createElement)("div",{className:"bbk-send-test__feedback"},C&&(0,r.createElement)("p",{className:"form-feedback form-feedback--success"},(0,r.createElement)(u,null),C),L&&(0,r.createElement)("p",{className:"form-feedback form-feedback--error"},(0,r.createElement)(m,null),L)),M&&(0,r.createElement)("div",{className:"bbk-preview-url"},(0,r.createElement)("span",{className:"bbk-preview-url__label"},(0,n.__)("Preview email in browser:","bubuku-media-library")),(0,r.createElement)("a",{href:M,target:"_blank",rel:"noreferrer",className:"bbk-preview-url__link"},(0,n.__)("Open preview →","bubuku-media-library")))),(0,r.createElement)("div",{className:"bk-card-footer"},(f||y)&&(0,r.createElement)("div",{className:"bk-card-footer__info"},f&&(0,r.createElement)("p",{className:"form-feedback form-feedback--success"},(0,r.createElement)(u,null),f),y&&(0,r.createElement)("p",{className:"form-feedback form-feedback--error"},(0,r.createElement)(m,null),y)),(0,r.createElement)("button",{type:"submit",form:"bbk-email-notifications-form",className:"bk-btn bk-btn-primary",disabled:k},(0,r.createElement)(c,null),k?(0,n.__)("Saving…","bubuku-media-library"):(0,n.__)("Save","bubuku-media-library"))))},p=e=>parseInt(String(e).replace(/\D/g,""),10)||0,k=({good:e,medium:t,bad:a})=>{const i=p(e),l=p(t),s=p(a),o=i+l+s,c=o>0?(s/o*100).toFixed(1):"0",u=[{key:"good",label:(0,n.__)("Good size","bubuku-media-library"),count:null!=e?e:0,variant:"good"},{key:"medium",label:(0,n.__)("Medium size","bubuku-media-library"),count:null!=t?t:0,variant:"medium"},{key:"bad",label:(0,n.__)("Large size","bubuku-media-library"),count:null!=a?a:0,variant:"bad"}];return(0,r.createElement)("div",{className:"bbk-size-summary"},(0,r.createElement)("div",{className:"bbk-size-tiles"},u.map(e=>(0,r.createElement)("div",{key:e.key,className:`bbk-size-tile bbk-size-tile--${e.variant}`},(0,r.createElement)("div",{className:"bbk-size-tile__number"},e.count),(0,r.createElement)("div",{className:"bbk-size-tile__label"},e.label)))),(0,r.createElement)("div",{className:"bbk-size-bar"},(0,r.createElement)("div",{className:"bbk-size-bar__track"},o>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"bbk-size-bar__segment bbk-size-bar__segment--good",style:{flex:i}}),(0,r.createElement)("div",{className:"bbk-size-bar__segment bbk-size-bar__segment--medium",style:{flex:l}}),(0,r.createElement)("div",{className:"bbk-size-bar__segment bbk-size-bar__segment--bad",style:{flex:s}}))),(0,r.createElement)("div",{className:"bbk-size-bar__footer"},(0,r.createElement)("span",{className:"bbk-size-bar__total"},(0,n.__)("Total:","bubuku-media-library")," ",(0,r.createElement)("strong",null,o.toLocaleString())," ",(0,n.__)("images analyzed","bubuku-media-library")),s>0&&(0,r.createElement)("span",{className:"bbk-size-bar__attention"},c,"% ",(0,n.__)("require attention","bubuku-media-library")))))},_=2*Math.PI*45,f=e=>parseInt(String(e).replace(/\D/g,""),10)||0,g=({altEmpty:e,total:t,withoutAlt:a,withAlt:i})=>{const l=f(null!=a?a:e),s=f(t),o=f(i),c=s>0?Math.min(l,s):l,u=o>0?o:Math.max(s-c,0),m=s>0?Math.min(l,s):0,d=s>0?Math.round(m/s*100):0,b=_*(1-d/100),h=(e=>e<10?"var(--success)":e<30?"var(--warning)":"var(--danger)")(d);return(0,r.createElement)("div",{className:"bbk-summary-alt-chart"},(0,r.createElement)("svg",{className:"bbk-summary-alt-chart__donut",width:"100",height:"100",viewBox:"0 0 100 100","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"50",cy:"50",r:45,fill:"none",stroke:"var(--border)",strokeWidth:"10"}),(0,r.createElement)("circle",{cx:"50",cy:"50",r:45,fill:"none",stroke:h,strokeWidth:"10",strokeDasharray:_,strokeDashoffset:b,strokeLinecap:"round",transform:"rotate(-90 50 50)"}),(0,r.createElement)("text",{x:"50",y:"46",textAnchor:"middle",dominantBaseline:"middle",fontSize:"16",fontWeight:"700",fill:h},d,"%"),(0,r.createElement)("text",{x:"50",y:"62",textAnchor:"middle",dominantBaseline:"middle",fontSize:"9",fill:"var(--bk-text-secondary)"},(0,n.__)("missing","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-summary-alt-chart__legend"},(0,r.createElement)("div",{className:"bbk-summary-alt-chart__legend-item"},(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-dot bbk-summary-alt-chart__legend-dot--missing"}),(0,n.__)("Without ALT","bubuku-media-library"),(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-value"},l.toLocaleString())),(0,r.createElement)("div",{className:"bbk-summary-alt-chart__legend-item"},(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-dot bbk-summary-alt-chart__legend-dot--present"}),(0,n.__)("With ALT","bubuku-media-library"),(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-value"},u.toLocaleString()))))},y=e=>parseInt(String(e).replace(/\D/g,""),10)||0,E=()=>(0,r.createElement)("div",{className:"bbk-summary-skeleton"},(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--full"}),(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--medium"}),(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--full"}),(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--short"})),v=()=>{const[e,t]=(0,i.useState)(""),[a,l]=(0,i.useState)(!1),[o,c]=(0,i.useState)(!0),[u,m]=(0,i.useState)(null),[d,b]=(0,i.useState)(!0),p=BbkMediaLibrary.api_url.endsWith("/")?BbkMediaLibrary.api_url.slice(0,-1):BbkMediaLibrary.api_url,_=`${p}/get-notification-settings`,f=`${p}/get-summary-stats`,v=BbkMediaLibrary._wpnonce;(0,i.useEffect)(()=>{fetch(_,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(e=>{t(e.data.emails),l(e.data.disabled),c(!1)})},[_,v]),(0,i.useEffect)(()=>{fetch(f,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(e=>{m(e),b(!1)}).catch(()=>{b(!1)})},[f]);let w=0;return u?.totals?.images_total?w=y(u.totals.images_total):u?.img_sizes&&(w=y(u.img_sizes.good)+y(u.img_sizes.medium)+y(u.img_sizes.bad)),(0,r.createElement)("div",{className:"bbk-dashboard"},(0,r.createElement)("div",{className:"bbk-summary-grid"},(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,r.createElement)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,r.createElement)("polyline",{points:"21 15 16 10 5 21"})),iconVariant:"icon-accent",title:(0,n.__)("Image Size","bubuku-media-library"),claim:(0,n.__)("Distribution by weight quality","bubuku-media-library"),animationDelay:".05s"},d?(0,r.createElement)(E,null):(0,r.createElement)(k,{good:u?.img_sizes?.good,medium:u?.img_sizes?.medium,bad:u?.img_sizes?.bad})),(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},(0,r.createElement)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,r.createElement)("circle",{cx:"12",cy:"12",r:"3"})),title:(0,n.__)("ALT Accessibility","bubuku-media-library"),claim:(0,n.__)("Images without alternative text","bubuku-media-library"),animationDelay:".1s"},d?(0,r.createElement)(E,null):(0,r.createElement)(g,{altEmpty:u?.img_alt_empty,total:w,withoutAlt:u?.totals?.without_alt,withAlt:u?.totals?.with_alt}))),!o&&(0,r.createElement)(h,{reportsEmails:e,reportsDisable:a}))},w=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"7 10 12 15 17 10"}),(0,r.createElement)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})),N=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),x=()=>{const[e,t]=(0,i.useState)("all"),[a,l]=(0,i.useState)("all"),[s,o]=(0,i.useState)(!1),[c,u]=(0,i.useState)(!1);let m=null;return m=c?(0,n.__)("Exporting…","bubuku-media-library"):s?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(N,null),(0,n.__)("Downloaded!","bubuku-media-library")):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(w,null),(0,n.__)("Export CSV","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-export-form"},(0,r.createElement)("div",{className:"bk-filters-grid"},(0,r.createElement)("div",{className:"bk-filter-group"},(0,r.createElement)("span",{className:"bk-filter-label"},(0,n.__)("Filter by ALT text","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-chip-group",role:"group","aria-label":(0,n.__)("Filter by ALT text","bubuku-media-library")},(0,r.createElement)("button",{type:"button",className:"bk-chip"+("all"===e?" bk-chip--active":""),onClick:()=>t("all"),"aria-pressed":"all"===e},(0,n.__)("All","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip"+("none"===e?" bk-chip--active":""),onClick:()=>t("none"),"aria-pressed":"none"===e},(0,n.__)("Without ALT","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip"+("some"===e?" bk-chip--active":""),onClick:()=>t("some"),"aria-pressed":"some"===e},(0,n.__)("With ALT","bubuku-media-library")))),(0,r.createElement)("div",{className:"bk-filter-group"},(0,r.createElement)("span",{className:"bk-filter-label"},(0,n.__)("Filter by size","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-chip-group",role:"group","aria-label":(0,n.__)("Filter by size","bubuku-media-library")},(0,r.createElement)("button",{type:"button",className:"bk-chip"+("all"===a?" bk-chip--active":""),onClick:()=>l("all"),"aria-pressed":"all"===a},(0,n.__)("All","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip bk-chip--good"+("good"===a?" bk-chip--active":""),onClick:()=>l("good"),"aria-pressed":"good"===a},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--good","aria-hidden":"true"}),(0,n.__)("Good","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip bk-chip--mid"+("mid"===a?" bk-chip--active":""),onClick:()=>l("mid"),"aria-pressed":"mid"===a},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--mid","aria-hidden":"true"}),(0,n.__)("Medium","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip bk-chip--bad"+("bad"===a?" bk-chip--active":""),onClick:()=>l("bad"),"aria-pressed":"bad"===a},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--bad","aria-hidden":"true"}),(0,n.__)("Bad","bubuku-media-library"))))),(0,r.createElement)("div",{className:"bk-size-legend"},(0,r.createElement)("div",{className:"bk-size-legend__item"},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--good","aria-hidden":"true"}),(0,r.createElement)("strong",{className:"bk-size-legend__label bk-size-legend__label--good"},(0,n.__)("Good","bubuku-media-library")),"< 100 KB"),(0,r.createElement)("div",{className:"bk-size-legend__item"},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--mid","aria-hidden":"true"}),(0,r.createElement)("strong",{className:"bk-size-legend__label bk-size-legend__label--mid"},(0,n.__)("Medium","bubuku-media-library")),"100–500 KB"),(0,r.createElement)("div",{className:"bk-size-legend__item"},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--bad","aria-hidden":"true"}),(0,r.createElement)("strong",{className:"bk-size-legend__label bk-size-legend__label--bad"},(0,n.__)("Bad","bubuku-media-library")),"> 500 KB")),(0,r.createElement)("div",{className:"bk-card-footer"},(0,r.createElement)("p",{className:"bk-card-footer__info bk-export-count"},(0,n.__)("Exporting","bubuku-media-library")," ",(0,r.createElement)("strong",null,(()=>{if("all"===e&&"all"===a)return(0,n.__)("all files","bubuku-media-library");const t=[];if("all"!==e&&t.push("none"===e?(0,n.__)("without ALT","bubuku-media-library"):(0,n.__)("with ALT","bubuku-media-library")),"all"!==a){const e={good:(0,n.__)("Good (< 100 KB)","bubuku-media-library"),mid:(0,n.__)("Medium (100–500 KB)","bubuku-media-library"),bad:(0,n.__)("Bad (> 500 KB)","bubuku-media-library")};t.push(e[a])}return t.join(", ")})())),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-primary",onClick:async()=>{u(!0);try{var t;const r=new URLSearchParams({alt_filter:e,size_filter:a}),i=await fetch(`${BbkMediaLibrary.api_url}/export-csv?${r}`,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}});if(!i.ok)throw new Error(`Error ${i.status}: ${i.statusText}`);const n=(null!==(t=i.headers.get("Content-Disposition"))&&void 0!==t?t:"").match(/filename="([^"]+)"/),l=n?n[1]:`media-library-export-${(new Date).toISOString().slice(0,10)}.csv`,s=await i.blob(),c=URL.createObjectURL(s),u=Object.assign(document.createElement("a"),{href:c,download:l});document.body.appendChild(u),u.click(),u.remove(),URL.revokeObjectURL(c),o(!0),setTimeout(()=>o(!1),3e3)}catch(e){console.error("CSV export failed:",e)}finally{u(!1)}},disabled:c},m)))};var C=a(809),S=a.n(C);const L=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),z=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.createElement)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),M=()=>{const[e,t]=(0,i.useState)(null),[a,l]=(0,i.useState)(!1),[s,o]=(0,i.useState)(0),[c,u]=(0,i.useState)(""),[m,d]=(0,i.useState)(""),[b,h]=(0,i.useState)(!1),p=(0,i.useRef)(null),k=`${BbkMediaLibrary.api_url}/import-alt-chunk`,_=BbkMediaLibrary.rest_nonce,f=["ID","Alt Text"],g=e=>{var t;return(null!==(t=e?.name)&&void 0!==t?t:"").toLowerCase().endsWith(".csv")},y=()=>{p.current&&p.current.click()};return(0,r.createElement)("form",{id:"bbk-import-alt-form",onSubmit:a=>{a.preventDefault(),e?(l(!0),o(0),u(""),d(""),S().parse(e,{header:!0,skipEmptyLines:!0,complete:async e=>{const a=e.data;if(0===a.length)return l(!1),void d((0,n.__)("The CSV file is empty.","bubuku-media-library"));const r=e.meta.fields||[],i=f.filter(e=>!r.includes(e));if(i.length>0)return l(!1),void d((0,n.sprintf)(/* translators: %s: comma-separated list of missing column names */ /* translators: %s: comma-separated list of missing column names */ 2 (0,n.__)("Invalid CSV structure. Missing required columns: %s","bubuku-media-library"),i.join(", ")));const s=Math.ceil(a.length/100);let c=0,m=[];for(let e=0;e<s;e++){const t=a.slice(100*e,100*(e+1));try{const e=await fetch(k,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":_},body:JSON.stringify({rows:t})}),a=await e.json();if(!e.ok||!a.success)throw new Error(a?.message||(0,n.__)("Failed to process chunk.","bubuku-media-library"));c+=a.data.updated||0,a.data.errors&&a.data.errors.length>0&&(m=m.concat(a.data.errors))}catch(t){console.error(`Chunk ${e+1} failed:`,t),m.push((0,n.sprintf)(/* translators: %d: chunk number */ /* translators: %d: chunk number */ 3 (0,n.__)("Chunk %d failed to process.","bubuku-media-library"),e+1))}o(Math.round((e+1)/s*100))}l(!1),o(100),m.length>0?d((0,n.sprintf)(/* translators: %1$d: processed rows, %2$d: total errors */ /* translators: %1$d: processed rows, %2$d: total errors */ 4 (0,n.__)("Import completed with errors. Processed: %1$d — Errors: %2$d","bubuku-media-library"),c,m.length)):u((0,n.sprintf)(/* translators: %d: number of updated images */ /* translators: %d: number of updated images */ 5 (0,n.__)("Import complete. Updated: %d","bubuku-media-library"),c)),t(null),p.current&&(p.current.value="")},error:e=>{l(!1),d((0,n.sprintf)(/* translators: %s: error message */ /* translators: %s: error message */ 6 (0,n.__)("Failed to parse CSV: %s","bubuku-media-library"),e.message))}})):d((0,n.__)("Please select a CSV file.","bubuku-media-library"))}},(0,r.createElement)("div",{className:"upload-zone"+(b?" upload-zone--dragging":""),id:"import-zone",onClick:y,onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.preventDefault(),h(!1)},onDrop:e=>{e.preventDefault(),h(!1);const a=e.dataTransfer.files[0]||null;if(a){if(!g(a))return void d((0,n.__)("Only .CSV files are accepted.","bubuku-media-library"));t(a),u(""),d("")}},onKeyDown:e=>"Enter"===e.key&&y(),role:"button",tabIndex:0,"aria-label":(0,n.__)("Click to select or drag a CSV file here","bubuku-media-library")},(0,r.createElement)("input",{ref:p,type:"file",id:"import-file",name:"csv_file",accept:".csv",onChange:e=>{const a=e.target.files[0]||null;if(a&&!g(a))return d((0,n.__)("Only .CSV files are accepted.","bubuku-media-library")),void(e.target.value="");t(a),u(""),d("")},disabled:a,style:{display:"none"}}),(0,r.createElement)("div",{className:"upload-zone-icon"},(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.createElement)("polyline",{points:"14 2 14 8 20 8"}),(0,r.createElement)("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),(0,r.createElement)("line",{x1:"9",y1:"15",x2:"15",y2:"15"}))),(0,r.createElement)("p",null,(0,r.createElement)("strong",null,(0,n.__)("Click to select","bubuku-media-library"))," ",(0,n.__)("or drag your file here","bubuku-media-library")),(0,r.createElement)("p",{className:"upload-hint"},(0,n.__)("Only .CSV files","bubuku-media-library"))),(0,r.createElement)("div",{className:"bk-card-footer"},(e||a&&s>0||c||m)&&(0,r.createElement)("div",{className:"bk-card-footer__info"},e&&(0,r.createElement)("div",{className:"file-selected",id:"import-selected"},(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),(0,r.createElement)("span",null,(0,n.__)("Selected file:","bubuku-media-library")," ",(0,r.createElement)("span",{className:"file-name"},e.name))),a&&s>0&&(0,r.createElement)("div",{className:"bk-progress-bar"},(0,r.createElement)("div",{className:"bk-progress-bar__track"},(0,r.createElement)("div",{className:"bk-progress-bar__fill",style:{width:`${s}%`}})),(0,r.createElement)("span",{className:"bk-progress-bar__label"},(0,n.sprintf)(/* translators: %1$d: progress percentage */ /* translators: %1$d: progress percentage */ 7 (0,n.__)("Processing… %1$d%%","bubuku-media-library"),s))),c&&(0,r.createElement)("p",{className:"bbk-notice bbk-notice--success"},(0,r.createElement)(L,null),c),m&&(0,r.createElement)("p",{className:"bbk-notice bbk-notice--error"},(0,r.createElement)(z,null),m)),(0,r.createElement)("button",{type:"submit",className:"bk-btn bk-btn-primary",id:"import-btn",disabled:a||!e},(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"17 8 12 3 7 8"}),(0,r.createElement)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),a?(0,n.__)("Importing…","bubuku-media-library"):(0,n.__)("Import ALT text","bubuku-media-library"))))},O=()=>(0,r.createElement)("div",{className:"bbk-dashboard"},(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"7 10 12 15 17 10"}),(0,r.createElement)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})),title:(0,n.__)("Export ALT text to CSV","bubuku-media-library"),claim:(0,n.__)("Download a CSV with image data filtered by your selection","bubuku-media-library"),animationDelay:".05s"},(0,r.createElement)(x,null)),(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"17 8 12 3 7 8"}),(0,r.createElement)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),title:(0,n.__)("Import ALT text from CSV","bubuku-media-library"),claim:(0,n.__)("Upload the exported CSV file to update the ALT text of the images","bubuku-media-library"),animationDelay:".1s"},(0,r.createElement)(M,null))),B='This image file size is too large to upload. To reduce the file size, go to: <a href="https://squoosh.app/" target="_blank" rel="noopener noreferrer">https://squoosh.app/</a> , upload your image and on the controls select <strong>AVIF</strong> under the heading Compress, and set the quality to 80 or above. Download, and upload this new file.',A={enabled:!1,max_size_mb:1,message:B,image_id:0,image_url:"",image_alt:""},R=e=>{if(!e||!e.success||!e.data)return null;const t=e.data;return{enabled:Boolean(t.enabled),max_size_mb:Number(t.max_size_mb)||A.max_size_mb,message:"string"==typeof t.message&&""!==t.message?t.message:B,image_id:Number(t.image_id)||0,image_url:"string"==typeof t.image_url?t.image_url:"",image_alt:"string"==typeof t.image_alt?t.image_alt:""}},T=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"17 8 12 3 7 8"}),(0,r.createElement)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),j=()=>{const[e,t]=(0,i.useState)(!0),[a,l]=(0,i.useState)(!1),[o,c]=(0,i.useState)(""),[u,m]=(0,i.useState)(""),[d,b]=(0,i.useState)(A),h=(0,i.useRef)(null),p=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/get-upload-limit-settings`,[]),k=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/set-upload-limit-settings`,[]);(0,i.useEffect)(()=>{fetch(p,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(e=>{const a=R(e);a&&b(a),t(!1)}).catch(()=>{c((0,n.__)("Could not load upload limit settings. Please refresh and try again.","bubuku-media-library")),t(!1)})},[p]);const _=(e,t)=>{b(a=>({...a,[e]:t}))},f=!d.enabled;return(0,r.createElement)(s,{title:(0,n.__)("Upload size limit","bubuku-media-library"),claim:(0,n.__)("Block images above a configurable size before they reach the library.","bubuku-media-library"),icon:(0,r.createElement)(T,null),animationDelay:".08s"},(0,r.createElement)("div",{className:"bbk-upload-limit-card"},e&&(0,r.createElement)("p",{className:"bbk-tools-placeholder"},(0,n.__)("Loading upload limit settings…","bubuku-media-library")),!e&&o&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--error"},o),!e&&u&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--success"},u),!e&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"bbk-upload-limit-layout"},(0,r.createElement)("div",{className:"bbk-upload-limit-row bbk-upload-limit-row--toggle"},(0,r.createElement)("label",{className:"bbk-tools-toggle",htmlFor:"bbk-upload-limit-enabled","aria-label":(0,n.__)("Enable upload size limit","bubuku-media-library")},(0,r.createElement)("input",{id:"bbk-upload-limit-enabled",type:"checkbox",checked:d.enabled,onChange:e=>_("enabled",e.target.checked)})),(0,r.createElement)("div",{className:"bbk-upload-limit-row-text"},(0,r.createElement)("strong",null,(0,n.__)("Block oversized image uploads","bubuku-media-library")),(0,r.createElement)("p",null,(0,n.__)("Applies to every role, administrators included. Only image files are affected.","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--size"},(0,r.createElement)("label",{htmlFor:"bbk-upload-limit-max-size"},(0,n.__)("Maximum size","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-max-size-input"},(0,r.createElement)("input",{id:"bbk-upload-limit-max-size",type:"number",step:"0.1",min:"0.1",max:"64",disabled:f,value:d.max_size_mb,onChange:e=>_("max_size_mb",""===e.target.value?"":Number(e.target.value))}),(0,r.createElement)("span",null,(0,n.__)("MB","bubuku-media-library"))),(0,r.createElement)("p",{className:"bbk-upload-limit-hint"},(0,n.__)("Only applies to image files (image/*).","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--message"},(0,r.createElement)("div",{className:"bbk-upload-limit-field-header"},(0,r.createElement)("label",{htmlFor:"bbk-upload-limit-message"},(0,n.__)("Message shown to editors","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",disabled:f,onClick:()=>{_("message",B)}},(0,n.__)("Restore default message","bubuku-media-library"))),(0,r.createElement)("textarea",{id:"bbk-upload-limit-message",rows:"8",className:"bbk-upload-limit-message-input",disabled:f,value:d.message,onChange:e=>_("message",e.target.value)}),(0,r.createElement)("p",{className:"bbk-upload-limit-hint"},(0,n.__)("Allowed tags: a, strong, b, em, i, br, p, ul, ol, li, code, span.","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--image"},(0,r.createElement)("span",{className:"bbk-upload-limit-field-label"},(0,n.__)("Supporting image","bubuku-media-library")),d.image_url?(0,r.createElement)("div",{className:"bbk-upload-limit-image-preview"},(0,r.createElement)("img",{src:d.image_url,alt:d.image_alt})):(0,r.createElement)("p",{className:"bbk-upload-limit-hint"},(0,n.__)("No image selected.","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-image-actions"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",disabled:f,onClick:()=>{"undefined"!=typeof wp&&wp.media&&(h.current||(h.current=wp.media({title:(0,n.__)("Select an image","bubuku-media-library"),library:{type:"image"},multiple:!1}),h.current.on("select",()=>{const e=h.current.state().get("selection"),t=e?e.first():null;if(!t)return;const a=t.toJSON();b(e=>({...e,image_id:a.id,image_url:a.sizes?.large?.url||a.url,image_alt:a.alt||""}))})),h.current.open())}},d.image_url?(0,n.__)("Replace image","bubuku-media-library"):(0,n.__)("Select image","bubuku-media-library")),d.image_url&&(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",disabled:f,onClick:()=>{b(e=>({...e,image_id:0,image_url:"",image_alt:""}))}},(0,n.__)("Remove","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--preview"},(0,r.createElement)("span",{className:"bbk-upload-limit-field-label"},(0,n.__)("Preview","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-mock-overlay","aria-hidden":"true"},(0,r.createElement)("div",{className:"bbk-upload-limit-mock-dialog"},(0,r.createElement)("span",{className:"bbk-upload-limit-mock-close"},"×"),(0,r.createElement)("h3",{className:"bbk-upload-limit-mock-title"},(0,n.__)("Image too large","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-mock-body",dangerouslySetInnerHTML:{__html:d.message}}),(0,r.createElement)("ul",{className:"bbk-upload-limit-mock-files"},(0,r.createElement)("li",null,"example-photo.jpg"," ",(0,r.createElement)("span",{className:"bbk-upload-limit-mock-file-size"},"(2.4 MB)"))),d.image_url&&(0,r.createElement)("img",{className:"bbk-upload-limit-mock-image",src:d.image_url,alt:""}))))),(0,r.createElement)("div",{className:"bbk-tools-actions"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-primary",onClick:()=>{l(!0),c(""),m(""),fetch(k,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":BbkMediaLibrary.rest_nonce},body:JSON.stringify({enabled:d.enabled,max_size_mb:""===d.max_size_mb?0:Number(d.max_size_mb),message:d.message,image_id:d.image_id})}).then(e=>e.json()).then(e=>{if(l(!1),!e||!e.success)return void c((0,n.__)("Could not save upload limit settings. Please try again.","bubuku-media-library"));const t=R(e);t&&b(t),m((0,n.__)("Upload limit settings saved.","bubuku-media-library"))}).catch(()=>{l(!1),c((0,n.__)("A network error occurred while saving. Please try again.","bubuku-media-library"))})},disabled:a},a?(0,n.__)("Saving…","bubuku-media-library"):(0,n.__)("Save upload limit settings","bubuku-media-library"))))))},W=()=>(0,r.createElement)("div",{className:"bbk-dashboard"},(0,r.createElement)(j,null)),P=(document.documentElement.lang||"en").toLowerCase();function D(e,t){const a=new URLSearchParams({utm_source:"bml-plugin",utm_medium:"wp-admin-footer",utm_campaign:"bml-plugin-footer-links",utm_content:t+"-"+P});return e+(e.includes("?")?"&":"?")+a.toString()}const I=[{href:D("https://www.bubuku.com/blog/anadir-texto-alternativo-wordpress/","article-add-alt-text"),label:(0,n.__)("How to add alternative text to images in WordPress for better SEO and accessibility","bubuku-media-library")},{href:D("https://www.bubuku.com/blog/alt-text-wpml-csv/","article-alt-text-csv-wpml"),label:(0,n.__)("How to export and import alternative text in WordPress with WPML and CSV files","bubuku-media-library")},{href:D("https://www.bubuku.com/blog/cambiar-imagenes-wordpress/","article-update-images"),label:(0,n.__)("How to change or update images in WordPress without impacting performance","bubuku-media-library")},{href:D("https://www.bubuku.com/blog/solucion-sizes-auto-wordpress/","article-sizes-auto"),label:(0,n.__)('How to solve problems with the sizes="auto" attribute in WordPress',"bubuku-media-library")},{href:D("https://www.bubuku.com/blog/optimizacion-carga-imagenes-wordpress/","article-optimize-image-loading"),label:(0,n.__)("How to optimize image loading in WordPress for better performance and Core Web Vitals","bubuku-media-library")}],F=[{label:(0,n.__)("Business-driven custom WordPress development","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"}))},{label:(0,n.__)("Plugins and external systems integrations","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),(0,r.createElement)("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"}))},{label:(0,n.__)("Continuous maintenance and support","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"23 4 23 10 17 10"}),(0,r.createElement)("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"}))},{label:(0,n.__)("Performance and conversion rate optimization","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),(0,r.createElement)("polyline",{points:"17 6 23 6 23 12"}))},{label:(0,n.__)("Technical implementation and integrations","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"12",cy:"12",r:"3"}),(0,r.createElement)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"}))}];function U(){return(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.createElement)("polyline",{points:"14 2 14 8 20 8"}),(0,r.createElement)("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),(0,r.createElement)("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),(0,r.createElement)("polyline",{points:"10 9 9 9 8 9"}))}function $(){return(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"}))}function H(){return(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,r.createElement)("polyline",{points:"12 5 19 12 12 19"}))}const q=D("https://www.bubuku.com/servicios/","cta-services"),V=function(){return(0,r.createElement)("footer",{className:"bk-footer-main"},(0,r.createElement)("div",{className:"bk-footer-main__inner"},(0,r.createElement)("div",{className:"bk-footer-main__resources"},(0,r.createElement)("div",{className:"bk-footer-main__section-title"},(0,r.createElement)("div",{className:"bk-footer-main__icon"},(0,r.createElement)(U,null)),(0,r.createElement)("p",{className:"bk-footer-main__heading"},(0,n.__)("Useful resources on image optimization (Spanish guides)","bubuku-media-library"))),(0,r.createElement)("p",{className:"bk-footer-main__description"},(0,n.__)("We've compiled some practical articles that can help you improve image loading and management in WordPress.","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-footer-main__divider"}),(0,r.createElement)("ul",{className:"bk-footer-main__links"},I.map((e,t)=>(0,r.createElement)("li",{key:t},(0,r.createElement)(U,null),(0,r.createElement)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer"},e.label))))),(0,r.createElement)("div",{className:"bk-footer-main__team"},(0,r.createElement)("div",{className:"bk-footer-main__team-title"},(0,r.createElement)("div",{className:"bk-footer-main__icon"},(0,r.createElement)($,null)),(0,r.createElement)("p",{className:"bk-footer-main__team-heading"},(0,n.__)("Technical partner for your WordPress projects","bubuku-media-library"))),(0,r.createElement)("p",{className:"bk-footer-main__team-description"},(0,n.__)("We work alongside marketing and business teams to improve the stability, performance, and evolution of your WordPress projects.","bubuku-media-library")),(0,r.createElement)("ul",{className:"bk-footer-main__services"},F.map((e,t)=>(0,r.createElement)("li",{key:t},e.icon,(0,r.createElement)("span",null,e.label)))),(0,r.createElement)("a",{href:q,target:"_blank",rel:"noopener noreferrer",className:"bk-footer-main__cta"},(0,n.__)("See how we work","bubuku-media-library"),(0,r.createElement)(H,null)))))},K=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,r.createElement)("path",{d:"M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4"}),(0,r.createElement)("path",{d:"M12 2v2"}),(0,r.createElement)("path",{d:"M9 12v9"}),(0,r.createElement)("path",{d:"M15 12v9"}),(0,r.createElement)("path",{d:"M5 16l4 -2"}),(0,r.createElement)("path",{d:"M15 14l4 2"}),(0,r.createElement)("path",{d:"M9 18h6"}),(0,r.createElement)("path",{d:"M10 8v.01"}),(0,r.createElement)("path",{d:"M14 8v.01"})),G=({animationDelay:e=".18s",showManageAction:t=!1,onManageTools:a=null})=>{const i=BbkMediaLibrary&&BbkMediaLibrary.mcp_server_url?String(BbkMediaLibrary.mcp_server_url):"",l=BbkMediaLibrary&&BbkMediaLibrary.profile_app_passwords_url?String(BbkMediaLibrary.profile_app_passwords_url):"/wp-admin/profile.php#application-passwords-section",o=i.trim().length>0,[c,u]=wp.element.useState(""),m=`{\n "mcpServers": {\n "bubuku-media-library": {\n "command": "npx",\n "args": [\n "-y",\n "mcp-remote",\n "${i}",\n "--header",\n "Authorization: Basic BASE64_OF_USER_AND_APP_PASSWORD"\n ]\n }\n }\n}`,d=async(e,t)=>{if(e)try{await navigator.clipboard.writeText(e),u(t),window.setTimeout(()=>{u(e=>e===t?"":e)},1800)}catch(e){u("")}},b=(0,r.createElement)("span",{className:"bbk-mcp-header-status "+(o?"is-active":"is-inactive")},o?(0,n.__)("Active","bubuku-media-library"):(0,n.__)("Inactive","bubuku-media-library"));return(0,r.createElement)(s,{icon:(0,r.createElement)(K,null),title:(0,n.__)("MCP Server","bubuku-media-library"),claim:(0,n.__)("Expose plugin abilities through one MCP server URL","bubuku-media-library"),headerMeta:b,animationDelay:e},(0,r.createElement)("div",{className:"bbk-agent-api-card"},(0,r.createElement)("div",{className:"bbk-mcp-url-block"},(0,r.createElement)("div",{className:"bbk-mcp-url-row"},(0,r.createElement)("span",{className:"bbk-mcp-url-value"},i||(0,n.__)("Unavailable","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>d(i,"server-url"),disabled:!i},"server-url"===c?(0,n.__)("Copied","bubuku-media-library"):(0,n.__)("Copy","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-mcp-divider","aria-hidden":"true"}),(0,r.createElement)("details",{className:"bbk-mcp-summary"},(0,r.createElement)("summary",null,(0,r.createElement)("span",{className:"bbk-mcp-summary-chevron","aria-hidden":"true"},(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},(0,r.createElement)("polyline",{points:"9 18 15 12 9 6"}))),(0,n.__)("Configure in Claude Desktop","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-mcp-summary__content"},(0,r.createElement)("ol",{className:"bbk-mcp-steps"},(0,r.createElement)("li",null,(0,r.createElement)("strong",null,(0,n.__)("Get your application password","bubuku-media-library")),(0,r.createElement)("span",null,(0,n.__)("Go to","bubuku-media-library")," ",(0,r.createElement)("a",{href:l,target:"_blank",rel:"noopener noreferrer"},(0,n.__)("Profile -> Application Passwords","bubuku-media-library"))," ",(0,n.__)("and create one for your WordPress user.","bubuku-media-library"))),(0,r.createElement)("li",null,(0,r.createElement)("strong",null,(0,n.__)("Encode credentials","bubuku-media-library")),(0,r.createElement)("span",null,(0,n.__)("Base64-encode","bubuku-media-library")," ",(0,r.createElement)("code",null,"username:app_password")," ",(0,n.__)("and replace","bubuku-media-library")," ",(0,r.createElement)("code",null,"BASE64_OF_USER_AND_APP_PASSWORD"),".")),(0,r.createElement)("li",null,(0,r.createElement)("strong",null,(0,n.__)("Add to claude_desktop_config.json","bubuku-media-library")),(0,r.createElement)("span",null,(0,n.__)("Requires","bubuku-media-library")," ",(0,r.createElement)("a",{href:"https://nodejs.org/",target:"_blank",rel:"noopener noreferrer"},(0,n.__)("Node.js","bubuku-media-library"))," ",(0,n.__)("- Claude Desktop uses","bubuku-media-library")," ",(0,r.createElement)("code",null,"mcp-remote")," ",(0,n.__)("via","bubuku-media-library")," ",(0,r.createElement)("code",null,"npx")," ",(0,n.__)("as a stdio bridge.","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-mcp-code-block"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>d(m,"snippet")},"snippet"===c?(0,n.__)("Copied","bubuku-media-library"):(0,n.__)("Copy","bubuku-media-library")),(0,r.createElement)("pre",null,(0,r.createElement)("code",null,m))),(0,r.createElement)("div",{className:"bbk-email-hint bbk-mcp-info-box"},(0,r.createElement)("p",null,(0,n.__)("This URL will return a 401 error when opened in a browser — that's normal, as it requires authenticated credentials.","bubuku-media-library"))))),t&&(0,r.createElement)("p",{className:"bbk-agent-api-card__action"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary",onClick:()=>{"function"==typeof a&&a()}},(0,n.__)("Manage per-tool abilities","bubuku-media-library")))))},X={tools:[],roles:{}},J=e=>e&&e.success&&e.data?{tools:Array.isArray(e.data.tools)?e.data.tools:[],roles:e.data.roles&&"object"==typeof e.data.roles?e.data.roles:{}}:X,Z=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"9 18 15 12 9 6"})),Q=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"11",cy:"11",r:"8"}),(0,r.createElement)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),Y=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),ee=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.createElement)("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})),te=({onToolsLoaded:e=null})=>{const[t,a]=(0,i.useState)(!0),[l,o]=(0,i.useState)(!1),[c,u]=(0,i.useState)(""),[m,d]=(0,i.useState)(""),[b,h]=(0,i.useState)(X),[p,k]=(0,i.useState)(null),[_,f]=(0,i.useState)(""),g=(0,i.useMemo)(()=>{if(!_.trim())return b.tools;const e=_.toLowerCase();return b.tools.filter(t=>(t.label||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)||(t.description||"").toLowerCase().includes(e))},[b.tools,_]),y=(0,i.useMemo)(()=>b.tools.filter(e=>e?.setting?.enabled).length,[b.tools]),E=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/get-tools-settings`,[]),v=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/set-tools-settings`,[]);(0,i.useEffect)(()=>{fetch(E,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(t=>{const r=J(t);h(r),a(!1),e&&e(r.tools.length)}).catch(()=>{u((0,n.__)("Could not load tools settings. Please refresh and try again.","bubuku-media-library")),a(!1)})},[E]);const w=e=>k(t=>t===e?null:e);return(0,r.createElement)("div",{className:"bbk-tools-abilities-panel"},(0,r.createElement)(G,{animationDelay:".06s"}),(0,r.createElement)(s,{title:(0,n.__)("Per-tool permissions","bubuku-media-library"),claim:(0,n.__)("Enable each tool and define the minimum role required to execute it.","bubuku-media-library"),icon:(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M12 20h9"}),(0,r.createElement)("path",{d:"M12 4h9"}),(0,r.createElement)("path",{d:"M4 9h16"}),(0,r.createElement)("path",{d:"M4 15h16"}),(0,r.createElement)("path",{d:"M5 4v16"}))},t&&(0,r.createElement)("p",{className:"bbk-tools-placeholder"},(0,n.__)("Loading tools settings...","bubuku-media-library")),!t&&c&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--error"},c),!t&&m&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--success"},m),!t&&!c&&0===b.tools.length&&(0,r.createElement)("p",{className:"bbk-tools-placeholder"},(0,n.__)("No tools were discovered. Check your tools loader configuration.","bubuku-media-library")),!t&&b.tools.length>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"bbk-tools-toolbar"},(0,r.createElement)("div",{className:"bbk-tools-search-wrap"},(0,r.createElement)(Q,null),(0,r.createElement)("input",{type:"search",className:"bbk-tools-search",placeholder:(0,n.__)("Search tools by name or slug...","bubuku-media-library"),value:_,onChange:e=>f(e.target.value)})),(0,r.createElement)("div",{className:"bbk-tools-toolbar-actions"},(0,r.createElement)("span",{className:"bbk-tools-enabled-count"},y," ",(0,n.__)("of","bubuku-media-library")," ",b.tools.length," ",(0,n.__)("enabled","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>{h(e=>({...e,tools:e.tools.map(e=>({...e,setting:{...e.setting,enabled:!0}}))}))}},(0,r.createElement)(Y,null),(0,n.__)("Enable all","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>{h(e=>({...e,tools:e.tools.map(e=>({...e,setting:{...e.setting,enabled:!1}}))}))}},(0,r.createElement)(ee,null),(0,n.__)("Disable all","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-tools-table-wrap"},(0,r.createElement)("table",{className:"bbk-tools-table"},(0,r.createElement)("thead",null,(0,r.createElement)("tr",null,(0,r.createElement)("th",{className:"bbk-tools-col-expand"}),(0,r.createElement)("th",null,(0,n.__)("Tool","bubuku-media-library")),(0,r.createElement)("th",{className:"bbk-tools-col-help"},(0,n.__)("Help","bubuku-media-library")),(0,r.createElement)("th",{className:"bbk-tools-col-role"},(0,n.__)("Minimum role","bubuku-media-library")),(0,r.createElement)("th",{className:"bbk-tools-col-enabled"},(0,n.__)("Enabled","bubuku-media-library")))),(0,r.createElement)("tbody",null,0===g.length?(0,r.createElement)("tr",null,(0,r.createElement)("td",{colSpan:5,className:"bbk-tools-no-results"},(0,n.__)("No tools match your search.","bubuku-media-library"))):null,g.map(e=>{const t=Boolean(e?.setting?.enabled),a=p===e.name,i=e?.setting?.role||"editor",l=`tool-${String(e.name).replace(/[^a-zA-Z0-9_-]/g,"-")}`,s=e.help?.criteria||e.help?.examples?.length>0;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("tr",{key:e.name,className:t?"":"is-disabled"},(0,r.createElement)("td",{className:"bbk-tools-col-expand"},s&&(0,r.createElement)("button",{type:"button",className:"bbk-tools-expand-btn"+(a?" is-open":""),onClick:()=>w(e.name),"aria-label":a?(0,n.__)("Collapse","bubuku-media-library"):(0,n.__)("Expand","bubuku-media-library"),"aria-expanded":a},(0,r.createElement)(Z,null))),(0,r.createElement)("td",null,(0,r.createElement)("strong",null,e.label),e.description&&(0,r.createElement)("p",{className:"bbk-tools-info-desc"},e.description)),(0,r.createElement)("td",{className:"bbk-tools-col-help"},s&&(0,r.createElement)("button",{type:"button",className:"bbk-tools-help-btn"+(a?" is-active":""),onClick:()=>w(e.name),"aria-label":(0,n.__)("Help","bubuku-media-library")},"?")),(0,r.createElement)("td",{className:"bbk-tools-col-role"},(0,r.createElement)("select",{value:i,onChange:t=>{return a=e.name,r=t.target.value,void h(e=>({...e,tools:e.tools.map(e=>e.name===a?{...e,setting:{...e.setting,role:r}}:e)}));var a,r}},Object.entries(b.roles).map(([e,t])=>(0,r.createElement)("option",{key:e,value:e},t))),!1===e.meets_capability_floor&&(0,r.createElement)("p",{className:"bbk-tools-role-warning",title:(0,n.__)("This tool always requires a minimum WordPress capability at runtime, regardless of the role selected here. The saved role is not being changed automatically.","bubuku-media-library")},(0,n.__)("⚠ Below this tool's required capability — it will still enforce it.","bubuku-media-library"))),(0,r.createElement)("td",{className:"bbk-tools-col-enabled"},(0,r.createElement)("label",{className:"bbk-tools-toggle",htmlFor:l},(0,r.createElement)("input",{id:l,type:"checkbox",checked:t,onChange:t=>{return a=e.name,r=t.target.checked,void h(e=>({...e,tools:e.tools.map(e=>e.name===a?{...e,setting:{...e.setting,enabled:r}}:e)}));var a,r}})))),a&&(0,r.createElement)("tr",{key:`${e.name}-info`,className:"bbk-tools-info-row"},(0,r.createElement)("td",{colSpan:"5"},(0,r.createElement)("div",{className:"bbk-tools-info-panel"},(e.help?.criteria||e.help?.examples?.length>0)&&(0,r.createElement)("div",{className:"bbk-tools-info-layout"},e.help?.criteria&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"bbk-tools-info-label"},(0,n.__)("When to use","bubuku-media-library")),(0,r.createElement)("p",{className:"bbk-tools-info-criteria"},e.help.criteria)),e.help?.examples?.length>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"bbk-tools-info-label"},(0,n.__)("Example prompts","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-tools-examples-list"},e.help.examples.map((t,a)=>(0,r.createElement)("div",{key:`${e.name}-ex-${a}`,className:"bbk-tools-example"},t)))))))))}))))),!t&&b.tools.length>0&&(0,r.createElement)("div",{className:"bbk-tools-actions"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-primary",onClick:()=>{o(!0),u(""),d("");const e=b.tools.reduce((e,t)=>(e[t.name]={enabled:t.setting?.enabled?1:0,role:t.setting?.role||"editor"},e),{});fetch(v,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":BbkMediaLibrary.rest_nonce},body:JSON.stringify({settings:e})}).then(e=>e.json()).then(e=>{o(!1),e&&e.success?(h(J(e)),d(e?.data?.message||(0,n.__)("Tools settings saved.","bubuku-media-library"))):u((0,n.__)("Could not save tools settings. Please try again.","bubuku-media-library"))}).catch(()=>{o(!1),u((0,n.__)("A network error occurred while saving. Please try again.","bubuku-media-library"))})},disabled:l},l?(0,n.__)("Saving...","bubuku-media-library"):(0,n.__)("Save tools settings","bubuku-media-library")))))},ae="overview",re="export-import",ie="settings",ne="tools-abilities",le=ae,se=[{id:ae,label:(0,n.__)("Overview","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))},{id:re,label:(0,n.__)("Export/Import","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5M16.5 3 21 7.5m0 0L16.5 12M21 7.5H7.5"}))},{id:ie,label:(0,n.__)("Settings","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 0 1 0 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.216.456a1.125 1.125 0 0 1-1.37-.49l-1.296-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 0 1 0-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.369-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281Z"}),(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))},{id:ne,label:(0,n.__)("Tools & Abilities","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","aria-hidden":"true"},(0,r.createElement)("path",{d:"M12 8V4H8"}),(0,r.createElement)("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),(0,r.createElement)("path",{d:"M2 14h2"}),(0,r.createElement)("path",{d:"M20 14h2"}),(0,r.createElement)("path",{d:"M15 13v2"}),(0,r.createElement)("path",{d:"M9 13v2"}))}],oe=()=>{const e=new URLSearchParams(window.location.search).get("tab");return se.some(t=>t.id===e)?e:le},ce=function(){const[e,t]=(0,i.useState)(()=>oe()),[a,s]=(0,i.useState)(0);(0,i.useEffect)(()=>{const e=()=>{t(oe())};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)}},[]);return(0,r.createElement)("div",{className:"bk-app"},(0,r.createElement)(l,null),(0,r.createElement)("div",{className:"bbk-admin-tabs",role:"tablist","aria-label":(0,n.__)("Bubuku Settings","bubuku-media-library")},se.map(({id:i,label:n,icon:l})=>(0,r.createElement)("button",{key:i,type:"button",role:"tab","aria-selected":e===i,className:"bbk-admin-tab "+(e===i?"is-active":""),onClick:()=>{return t(e=i),void(e=>{const t=new URL(window.location.href);e===le?t.searchParams.delete("tab"):t.searchParams.set("tab",e),window.history.replaceState({},"",`${t.pathname}${t.search}`)})(e);var e}},(0,r.createElement)(l,null),n,i===ne&&a>0&&(0,r.createElement)("span",{className:"bbk-admin-tab__badge"},a)))),(0,r.createElement)("div",{role:"tabpanel"},e===ae&&(0,r.createElement)(v,null),e===re&&(0,r.createElement)(O,null),e===ie&&(0,r.createElement)(W,null),e===ne&&(0,r.createElement)(te,{onToolsLoaded:s})),(0,r.createElement)(V,null))};document.addEventListener("DOMContentLoaded",function(){const e=document.getElementById("bbk-media-library-app");null!=e&&(0,i.createRoot)(e).render((0,r.createElement)(ce,null))})},901(){},809(e,t){var a,r;a=function e(){var t,a="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==a?a:{},r=!a.document&&!!a.postMessage,i=a.IS_PAPA_WORKER||!1,n={},l=0,s={};function o(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=g(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new b(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,t){var r=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<r){let t=this._config.newline;t||(n=this._config.quoteChar||'"',t=this._handle.guessLineEndings(e,n)),e=[...e.split(t).slice(r)].join(t)}this.isFirstChunk&&E(this._config.beforeFirstChunk)&&void 0!==(n=this._config.beforeFirstChunk(e))&&(e=n),this.isFirstChunk=!1,this._halted=!1,r=this._partialLine+e;var n=(this._partialLine="",this._handle.parse(r,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(e=n.meta.cursor,this._finished||(this._partialLine=r.substring(e-this._baseIndex),this._baseIndex=e),n&&n.data&&(this._rowCount+=n.data.length),r=this._finished||this._config.preview&&this._rowCount>=this._config.preview,i)a.postMessage({results:n,workerId:s.WORKER_ID,finished:r});else if(E(this._config.chunk)&&!t){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=n=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!r||!E(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),r||n&&n.meta.paused||this._nextChunk(),n}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):i&&this._config.error&&a.postMessage({workerId:s.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=s.RemoteChunkSize),o.call(this,e),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),r||(t.onload=y(this._chunkLoaded,this),t.onerror=y(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var e,a=this._config.downloadRequestHeaders;for(e in a)t.setRequestHeader(e,a[e])}var i;this._config.chunkSize&&(i=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+i));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}r&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(e=>null!==(e=e.getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1)(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(new Error(e))}}function u(e){(e=e||{}).chunkSize||(e.chunkSize=s.LocalChunkSize),o.call(this,e);var t,a,r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,a=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=y(this._chunkLoaded,this),t.onerror=y(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input,i=(this._config.chunkSize&&(i=Math.min(this._start+this._config.chunkSize,this._input.size),e=a.call(e,this._start,i)),t.readAsText(e,this._config.encoding));r||this._chunkLoaded({target:{result:i}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function m(e){var t;o.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,a;if(!this._finished)return e=this._config.chunkSize,t=e?(a=t.substring(0,e),t.substring(e)):(a=t,""),this._finished=!t,this.parseChunk(a)}}function d(e){o.call(this,e=e||{});var t=[],a=!0,r=!1;this.pause=function(){o.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){o.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):a=!0},this._streamData=y(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),a&&(a=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=y(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=y(function(){this._streamCleanUp(),r=!0,this._streamData("")},this),this._streamCleanUp=y(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function b(e){var t,a,r,i,n=Math.pow(2,53),l=-n,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,c=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,u=this,m=0,d=0,b=!1,k=!1,_=[],f={data:[],errors:[],meta:{}};function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function v(){if(f&&r&&(N("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(f.data=f.data.filter(function(e){return!y(e)})),w()){if(f)if(Array.isArray(f.data[0])){for(var t=0;w()&&t<f.data.length;t++)f.data[t].forEach(a);f.data.splice(0,1)}else f.data.forEach(a);function a(t,a){E(e.transformHeader)&&(t=e.transformHeader(t,a)),_.push(t)}}function i(t,a){for(var r=e.header?{}:[],i=0;i<t.length;i++){var s=i,u=t[i];u=((t,a)=>(t=>(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping)))(t)?"true"===a||"TRUE"===a||"false"!==a&&"FALSE"!==a&&((e=>{if(o.test(e)&&(e=parseFloat(e),l<e&&e<n))return 1})(a)?parseFloat(a):c.test(a)?new Date(a):""===a?null:a):a)(s=e.header?i>=_.length?"__parsed_extra":_[i]:s,u=e.transform?e.transform(u,s):u),"__parsed_extra"===s?(r[s]=r[s]||[],r[s].push(u)):r[s]=u}return e.header&&(i>_.length?N("FieldMismatch","TooManyFields","Too many fields: expected "+_.length+" fields but parsed "+i,d+a):i<_.length&&N("FieldMismatch","TooFewFields","Too few fields: expected "+_.length+" fields but parsed "+i,d+a)),r}var u;f&&(e.header||e.dynamicTyping||e.transform)&&(u=1,!f.data.length||Array.isArray(f.data[0])?(f.data=f.data.map(i),u=f.data.length):f.data=i(f.data,0),e.header&&f.meta&&(f.meta.fields=_),d+=u)}function w(){return e.header&&0===_.length}function N(e,t,a,r){e={type:e,code:t,message:a},void 0!==r&&(e.row=r),f.errors.push(e)}E(e.step)&&(i=e.step,e.step=function(t){f=t,w()?v():(v(),0!==f.data.length&&(m+=t.data.length,e.preview&&m>e.preview?a.abort():(f.data=f.data[0],i(f,u))))}),this.parse=function(i,n,l){var o=e.quoteChar||'"';return e.newline||(e.newline=this.guessLineEndings(i,o)),r=!1,e.delimiter?E(e.delimiter)&&(e.delimiter=e.delimiter(i),f.meta.delimiter=e.delimiter):((o=((t,a,r,i,n)=>{var l,o,c,u;n=n||[",","\t","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var m=0;m<n.length;m++){for(var d,b=n[m],h=0,k=0,_=0,f=(c=void 0,new p({comments:i,delimiter:b,newline:a,preview:10}).parse(t)),g=0;g<f.data.length;g++)r&&y(f.data[g])?_++:(k+=d=f.data[g].length,void 0===c?c=d:0<d&&(h+=Math.abs(d-c),c=d));0<f.data.length&&(k/=f.data.length-_),(void 0===o||h<=o)&&(void 0===u||u<k)&&1.99<k&&(o=h,l=b,u=k)}return{successful:!!(e.delimiter=l),bestDelimiter:l}})(i,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess)).successful?e.delimiter=o.bestDelimiter:(r=!0,e.delimiter=s.DefaultDelimiter),f.meta.delimiter=e.delimiter),o=g(e),e.preview&&e.header&&o.preview++,t=i,a=new p(o),f=a.parse(t,n,l),v(),b?{meta:{paused:!0}}:f||{meta:{paused:!1}}},this.paused=function(){return b},this.pause=function(){b=!0,a.abort(),t=E(e.chunk)?"":t.substring(a.getCharIndex())},this.resume=function(){u.streamer._halted?(b=!1,u.streamer.parseChunk(t,!0)):setTimeout(u.resume,3)},this.aborted=function(){return k},this.abort=function(){k=!0,a.abort(),f.meta.aborted=!0,E(e.complete)&&e.complete(f),t=""},this.guessLineEndings=function(e,t){e=e.substring(0,1048576),t=new RegExp(h(t)+"([^]*?)"+h(t),"gm");var a=(e=e.replace(t,"")).split("\r");if(e=1<(t=e.split("\n")).length&&t[0].length<a[0].length,1===a.length||e)return"\n";for(var r=0,i=0;i<a.length;i++)"\n"===a[i][0]&&r++;return r>=a.length/2?"\r\n":"\r"}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function p(e){var t=(e=e||{}).delimiter,a=e.newline,r=e.comments,i=e.step,n=e.preview,l=e.fastMode,o=null,c=!1,u=null==e.quoteChar?'"':e.quoteChar,m=u;if(void 0!==e.escapeChar&&(m=e.escapeChar),("string"!=typeof t||-1<s.BAD_DELIMITERS.indexOf(t))&&(t=","),r===t)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<s.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==a&&"\r"!==a&&"\r\n"!==a&&(a="\n");var d=0,b=!1;this.parse=function(s,p,k){if("string"!=typeof s)throw new Error("Input must be a string");var _=s.length,f=t.length,g=a.length,y=r.length,v=E(i),w=[],N=[],x=[],C=d=0;if(!s)return P();if(l||!1!==l&&-1===s.indexOf(u)){for(var S=s.split(a),L=0;L<S.length;L++){if(x=S[L],d+=x.length,L!==S.length-1)d+=a.length;else if(k)return P();if(!r||x.substring(0,y)!==r){if(v){if(w=[],R(x.split(t)),D(),b)return P()}else R(x.split(t));if(n&&n<=L)return w=w.slice(0,n),P(!0)}}return P()}for(var z=s.indexOf(t,d),M=s.indexOf(a,d),O=new RegExp(h(m)+h(u),"g"),B=s.indexOf(u,d);;)if(s[d]===u)for(B=d,d++;;){if(-1===(B=s.indexOf(u,B+1)))return k||N.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:w.length,index:d}),j();if(B===_-1)return j(s.substring(d,B).replace(O,u));if(u===m&&s[B+1]===m)B++;else if(u===m||0===B||s[B-1]!==m){-1!==z&&z<B+1&&(z=s.indexOf(t,B+1));var A=T(-1===(M=-1!==M&&M<B+1?s.indexOf(a,B+1):M)?z:Math.min(z,M));if(s.substr(B+1+A,f)===t){x.push(s.substring(d,B).replace(O,u)),s[d=B+1+A+f]!==u&&(B=s.indexOf(u,d)),z=s.indexOf(t,d),M=s.indexOf(a,d);break}if(A=T(M),s.substring(B+1+A,B+1+A+g)===a){if(x.push(s.substring(d,B).replace(O,u)),W(B+1+A+g),z=s.indexOf(t,d),B=s.indexOf(u,d),v&&(D(),b))return P();if(n&&w.length>=n)return P(!0);break}N.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:d}),B++}}else if(r&&0===x.length&&s.substring(d,d+y)===r){if(-1===M)return P();d=M+g,M=s.indexOf(a,d),z=s.indexOf(t,d)}else if(-1!==z&&(z<M||-1===M))x.push(s.substring(d,z)),d=z+f,z=s.indexOf(t,d);else{if(-1===M)break;if(x.push(s.substring(d,M)),W(M+g),v&&(D(),b))return P();if(n&&w.length>=n)return P(!0)}return j();function R(e){w.push(e),C=d}function T(e){return-1!==e&&(e=s.substring(B+1,e))&&""===e.trim()?e.length:0}function j(e){return k||(void 0===e&&(e=s.substring(d)),x.push(e),d=_,R(x),v&&D()),P()}function W(e){d=e,R(x),x=[],M=s.indexOf(a,d)}function P(r){if(e.header&&!p&&w.length&&!c){var i=w[0],n=Object.create(null),l=new Set(i);let t=!1;for(let a=0;a<i.length;a++){let r=i[a];if(n[r=E(e.transformHeader)?e.transformHeader(r,a):r]){let e,s=n[r];for(;e=r+"_"+s,s++,l.has(e););l.add(e),i[a]=e,n[r]++,t=!0,(o=null===o?{}:o)[e]=r}else n[r]=1,i[a]=r;l.add(r)}t&&console.warn("Duplicate headers found and renamed."),c=!0}return{data:w,errors:N,meta:{delimiter:t,linebreak:a,aborted:b,truncated:!!r,cursor:C+(p||0),renamedHeaders:o}}}function D(){i(P()),w=[],N=[]}},this.abort=function(){b=!0},this.getCharIndex=function(){return d}}function k(e){var t=e.data,a=n[t.workerId],r=!1;if(t.error)a.userError(t.error,t.file);else if(t.results&&t.results.data){var i={abort:function(){r=!0,_(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:f,resume:f};if(E(a.userStep)){for(var l=0;l<t.results.data.length&&(a.userStep({data:t.results.data[l],errors:t.results.errors,meta:t.results.meta},i),!r);l++);delete t.results}else E(a.userChunk)&&(a.userChunk(t.results,i,t.file),delete t.results)}t.finished&&!r&&_(t.workerId,t.results)}function _(e,t){var a=n[e];E(a.userComplete)&&a.userComplete(t),a.terminate(),delete n[e]}function f(){throw new Error("Not implemented.")}function g(e){if("object"!=typeof e||null===e)return e;var t,a=Array.isArray(e)?[]:{};for(t in e)a[t]=g(e[t]);return a}function y(e,t){return function(){e.apply(t,arguments)}}function E(e){return"function"==typeof e}return s.parse=function(t,r){var i=(r=r||{}).dynamicTyping||!1;if(E(i)&&(r.dynamicTypingFunction=i,i={}),r.dynamicTyping=i,r.transform=!!E(r.transform)&&r.transform,!r.worker||!s.WORKERS_SUPPORTED)return i=null,s.NODE_STREAM_INPUT,"string"==typeof t?(t=(e=>65279!==e.charCodeAt(0)?e:e.slice(1))(t),i=new(r.download?c:m)(r)):!0===t.readable&&E(t.read)&&E(t.on)?i=new d(r):(a.File&&t instanceof File||t instanceof Object)&&(i=new u(r)),i.stream(t);(i=(()=>{var t;return!!s.WORKERS_SUPPORTED&&(t=(()=>{var t=a.URL||a.webkitURL||null,r=e.toString();return s.BLOB_URL||(s.BLOB_URL=t.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",r,")();"],{type:"text/javascript"})))})(),(t=new a.Worker(t)).onmessage=k,t.id=l++,n[t.id]=t)})()).userStep=r.step,i.userChunk=r.chunk,i.userComplete=r.complete,i.userError=r.error,r.step=E(r.step),r.chunk=E(r.chunk),r.complete=E(r.complete),r.error=E(r.error),delete r.worker,i.postMessage({input:t,config:r,workerId:i.id})},s.unparse=function(e,t){var a=!1,r=!0,i=",",n="\r\n",l='"',o=l+l,c=!1,u=null,m=!1,d=((()=>{if("object"==typeof t){if("string"!=typeof t.delimiter||s.BAD_DELIMITERS.filter(function(e){return-1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),"boolean"!=typeof t.quotes&&"function"!=typeof t.quotes&&!Array.isArray(t.quotes)||(a=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(n=t.newline),"string"==typeof t.quoteChar&&(l=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");u=t.columns}void 0!==t.escapeChar&&(o=t.escapeChar+l),t.escapeFormulae instanceof RegExp?m=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(m=/^[=+\-@\t\r].*$/)}})(),new RegExp(h(l),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return b(null,e,c);if("object"==typeof e[0])return b(u||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||u),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),b(e.fields||[],e.data||[],c);throw new Error("Unable to serialize unrecognized input");function b(e,t,a){var l="",s=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0<e.length),o=!Array.isArray(t[0]);if(s&&r){for(var c=0;c<e.length;c++)0<c&&(l+=i),l+=p(e[c],c);0<t.length&&(l+=n)}for(var u=0;u<t.length;u++){var m=(s?e:t[u]).length,d=!1,b=s?0===Object.keys(t[u]).length:0===t[u].length;if(a&&!s&&(d="greedy"===a?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===a&&s){for(var h=[],k=0;k<m;k++){var _=o?e[k]:k;h.push(t[u][_])}d=""===h.join("").trim()}if(!d){for(var f=0;f<m;f++){0<f&&!b&&(l+=i);var g=s&&o?e[f]:f;l+=p(t[u][g],f)}u<t.length-1&&(!a||0<m&&!b)&&(l+=n)}}return l}function p(e,t){var r,n;return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(n=!1,m&&"string"==typeof e&&m.test(e)&&(e="'"+e,n=!0),r=e.toString().replace(d,o),(n=n||!0===a||"function"==typeof a&&a(e,t)||Array.isArray(a)&&a[t]||((e,t)=>{for(var a=0;a<t.length;a++)if(-1<e.indexOf(t[a]))return!0;return!1})(r,s.BAD_DELIMITERS)||-1<r.indexOf(i)||" "===r.charAt(0)||" "===r.charAt(r.length-1))?l+r+l:r)}},s.RECORD_SEP=String.fromCharCode(30),s.UNIT_SEP=String.fromCharCode(31),s.BYTE_ORDER_MARK="\ufeff",s.BAD_DELIMITERS=["\r","\n",'"',s.BYTE_ORDER_MARK],s.WORKERS_SUPPORTED=!r&&!!a.Worker,s.NODE_STREAM_INPUT=1,s.LocalChunkSize=10485760,s.RemoteChunkSize=5242880,s.DefaultDelimiter=",",s.Parser=p,s.ParserHandle=b,s.NetworkStreamer=c,s.FileStreamer=u,s.StringStreamer=m,s.ReadableStreamStreamer=d,a.jQuery&&((t=a.jQuery).fn.parse=function(e){var r=e.config||{},i=[];return this.each(function(e){if("INPUT"!==t(this).prop("tagName").toUpperCase()||"file"!==t(this).attr("type").toLowerCase()||!a.FileReader||!this.files||0===this.files.length)return!0;for(var n=0;n<this.files.length;n++)i.push({file:this.files[n],inputElem:this,instanceConfig:t.extend({},r)})}),n(),this;function n(){if(0===i.length)E(e.complete)&&e.complete();else{var a,r,n,o=i[0];if(E(e.before)){var c=e.before(o.file,o.inputElem);if("object"==typeof c){if("abort"===c.action)return a=o.file,r=o.inputElem,n=c.reason,void(E(e.error)&&e.error({name:"AbortError"},a,r,n));if("skip"===c.action)return void l();"object"==typeof c.config&&(o.instanceConfig=t.extend(o.instanceConfig,c.config))}else if("skip"===c)return void l()}var u=o.instanceConfig.complete;o.instanceConfig.complete=function(e){E(u)&&u(e,o.file,o.inputElem),l()},s.parse(o.file,o.instanceConfig)}}function l(){i.splice(0,1),n()}}),i&&(a.onmessage=function(e){e=e.data,void 0===s.WORKER_ID&&e&&(s.WORKER_ID=e.workerId),"string"==typeof e.input?a.postMessage({workerId:s.WORKER_ID,results:s.parse(e.input,e.config),finished:!0}):(a.File&&e.input instanceof File||e.input instanceof Object)&&(e=s.parse(e.input,e.config))&&a.postMessage({workerId:s.WORKER_ID,results:e,finished:!0})}),(c.prototype=Object.create(o.prototype)).constructor=c,(u.prototype=Object.create(o.prototype)).constructor=u,(m.prototype=Object.create(m.prototype)).constructor=m,(d.prototype=Object.create(o.prototype)).constructor=d,s},void 0===(r=a.apply(t,[]))||(e.exports=r)}},a={};function r(e){var i=a[e];if(void 0!==i)return i.exports;var n=a[e]={exports:{}};return t[e].call(n.exports,n,n.exports,r),n.exports}r.m=t,e=[],r.O=(t,a,i,n)=>{if(!a){var l=1/0;for(u=0;u<e.length;u++){for(var[a,i,n]=e[u],s=!0,o=0;o<a.length;o++)(!1&n||l>=n)&&Object.keys(r.O).every(e=>r.O[e](a[o]))?a.splice(o--,1):(s=!1,n<l&&(l=n));if(s){e.splice(u--,1);var c=i();void 0!==c&&(t=c)}}return t}n=n||0;for(var u=e.length;u>0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[a,i,n]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={884:0,15:0};r.O.j=t=>0===e[t];var t=(t,a)=>{var i,n,[l,s,o]=a,c=0;if(l.some(t=>0!==e[t])){for(i in s)r.o(s,i)&&(r.m[i]=s[i]);if(o)var u=o(r)}for(t&&t(a);c<l.length;c++)n=l[c],r.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return r.O(u)},a=globalThis.webpackChunkbubuku_media_library=globalThis.webpackChunkbubuku_media_library||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})(),r.O(void 0,[15],()=>r(980));var i=r.O(void 0,[15],()=>r(901));i=r.O(i)})(); 1 (()=>{var e,t={651(e,t,a){"use strict";const r=window.React,i=window.wp.element,n=window.wp.i18n,l=function(){return(0,r.createElement)("div",{className:"bk-header-main"},(0,r.createElement)("div",{className:"bk-icon"},(0,r.createElement)("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},(0,r.createElement)("rect",{x:"16",y:"16",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeOpacity:"0.85",strokeWidth:"1.8",fill:"currentColor",fillOpacity:"0.1"}),(0,r.createElement)("circle",{cx:"20",cy:"20",r:"1.5",stroke:"currentColor",strokeOpacity:"0.85",strokeWidth:"1.5",fill:"none"}),(0,r.createElement)("polyline",{points:"34 28 30 23 21 34",stroke:"currentColor",strokeOpacity:"0.85",strokeWidth:"1.8"}),(0,r.createElement)("circle",{cx:"11",cy:"11",r:"8.5",stroke:"currentColor",strokeWidth:"2.5",fill:"currentColor",fillOpacity:"0.18"}),(0,r.createElement)("circle",{cx:"8.5",cy:"8.5",r:"2",stroke:"currentColor",strokeOpacity:"0.4",strokeWidth:"1",fill:"none"}),(0,r.createElement)("line",{x1:"4.5",y1:"17.5",x2:"1",y2:"21",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round"}))),(0,r.createElement)("div",null,(0,r.createElement)("p",{className:"bk-title"},(0,i.createInterpolateElement)((0,n.__)("Bubuku Media Library <span>Settings</span>","bubuku-media-library"),{span:(0,r.createElement)("span",null)})),(0,r.createElement)("p",{className:"bk-subtitle"},(0,n.__)("Manage and optimize your WordPress media library","bubuku-media-library"))))},s=({icon:e,iconVariant:t="icon-accent",title:a,claim:i,animationDelay:n,headerMeta:l=null,children:s})=>{const o=n?{animationDelay:n}:void 0;return(0,r.createElement)("div",{className:"bk-dashboard-card",style:o},(0,r.createElement)("div",{className:"card-header"},(0,r.createElement)("div",{className:"card-header-main"},(0,r.createElement)("div",{className:`card-header-icon ${t}`},e),(0,r.createElement)("div",{className:"card-header-text"},(0,r.createElement)("h2",null,a),(0,r.createElement)("p",null,i))),l&&(0,r.createElement)("div",{className:"card-header-meta"},l)),(0,r.createElement)("div",{className:"card-body"},s))},o=()=>(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),(0,r.createElement)("polyline",{points:"22,6 12,13 2,6"})),u=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),(0,r.createElement)("polyline",{points:"17 21 17 13 7 13 7 21"}),(0,r.createElement)("polyline",{points:"7 3 7 8 15 8"})),c=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),m=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.createElement)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),d=()=>(0,r.createElement)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.createElement)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,r.createElement)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})),b=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,r.createElement)("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})),h=({reportsEmails:e,reportsDisable:t})=>{const[a,l]=(0,i.useState)(""),[h,p]=(0,i.useState)(0),[_,k]=(0,i.useState)(!1),[f,y]=(0,i.useState)(""),[g,E]=(0,i.useState)(""),[v,w]=(0,i.useState)(""),[N,x]=(0,i.useState)(!1),[C,S]=(0,i.useState)(""),[L,M]=(0,i.useState)(""),[T,D]=(0,i.useState)(""),R=`${BbkMediaLibrary.api_url}/set-notification-settings`,z=`${BbkMediaLibrary.api_url}/set-reports-disable`,A=`${BbkMediaLibrary.api_url}/send-manual-report`,O=`${BbkMediaLibrary.api_url}/get-report-preview-url`,I=BbkMediaLibrary._wpnonce,P=BbkMediaLibrary.rest_nonce;return(0,i.useEffect)(()=>{l(null!=e?e:""),p(null!=t?t:0)},[t,e]),(0,i.useEffect)(()=>{fetch(O,{method:"GET",headers:{"X-WP-Nonce":P}}).then(e=>e.json()).then(e=>{e&&e.preview_url&&D(e.preview_url)}).catch(()=>{})},[O,P]),(0,r.createElement)(s,{icon:(0,r.createElement)(o,null),title:(0,n.__)("Email notifications","bubuku-media-library"),claim:(0,n.__)("Receive automatic reports in your inbox","bubuku-media-library")},(0,r.createElement)("form",{id:"bbk-email-notifications-form",onSubmit:e=>{e.preventDefault(),y(""),E("");const t=a.split(",");let r=!0;t.forEach(e=>{e.trim().match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)||(r=!1)}),r?(k(!0),fetch(R,{method:"POST",body:JSON.stringify({emails:a,_wpnonce:I}),headers:{"Content-Type":"application/json","X-WP-Nonce":P}}).then(e=>e.json()).then(e=>{k(!1),e.success?y((0,n.__)("Settings saved successfully","bubuku-media-library")):E((0,n.__)("Error saving settings","bubuku-media-library"))}).catch(()=>{k(!1),E((0,n.__)("Network error. Please try again.","bubuku-media-library"))})):E((0,n.__)("Invalid email format","bubuku-media-library"))},className:"bbk-email-notifications"},(0,r.createElement)("div",{className:"form-row"},(0,r.createElement)("div",{className:"form-row__label"},(0,r.createElement)("span",{className:"form-row__title"},(0,n.__)("Emails to notify","bubuku-media-library")),(0,r.createElement)("span",{className:"form-row__help"},(0,n.__)("Comma separated","bubuku-media-library"))),(0,r.createElement)("div",{className:"form-row__control"},(0,r.createElement)("input",{type:"text",name:"emails",id:"bbk-emails",value:a,onChange:e=>{l(e.target.value),y(""),E("")},disabled:_}))),(0,r.createElement)("div",{className:"form-row form-row--separated"},(0,r.createElement)("div",{className:"form-row__label"},(0,r.createElement)("span",{className:"form-row__title"},(0,n.__)("Weekly reports","bubuku-media-library")),(0,r.createElement)("span",{className:"form-row__help"},(0,n.__)("Sending frequency","bubuku-media-library"))),(0,r.createElement)("div",{className:"form-row__control"},(0,r.createElement)("select",{name:"disable_reports",id:"disable_reports",value:h,onChange:e=>{const t=parseInt(e.target.value,10);p(t),fetch(z,{method:"POST",body:JSON.stringify({disable_reports:t,_wpnonce:I}),headers:{"Content-Type":"application/json","X-WP-Nonce":P}}).then(e=>e.json()).catch(()=>{})}},(0,r.createElement)("option",{value:"0"},(0,n.__)("Disabled","bubuku-media-library")),(0,r.createElement)("option",{value:"1"},(0,n.__)("Weekly","bubuku-media-library")),(0,r.createElement)("option",{value:"2"},(0,n.__)("Monthly","bubuku-media-library")))))),(0,r.createElement)("div",{className:"bbk-email-hint"},(0,r.createElement)(d,null),(0,r.createElement)("p",null,(0,n.__)("You will receive an email report with the file sizes of your media library. Use it to identify heavy images, optimize your site’s performance, and improve your users’ experience.","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-send-test"},(0,r.createElement)("div",{className:"bbk-send-test__header"},(0,r.createElement)("span",{className:"bbk-send-test__title"},(0,n.__)("Send test report","bubuku-media-library")),(0,r.createElement)("span",{className:"bbk-send-test__help"},(0,n.__)("Send the report to one or more addresses right now","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-send-test__row"},(0,r.createElement)("input",{className:"bbk-send-test__input",type:"text",value:v,placeholder:"email@example.com",onChange:e=>{w(e.target.value),S(""),M("")},disabled:N}),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary",onClick:()=>{S(""),M("");const e=v.trim();if(!e)return;const t=e.split(",");let a=!0;t.forEach(e=>{e.trim().match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)||(a=!1)}),a?(x(!0),fetch(A,{method:"POST",body:JSON.stringify({emails:e}),headers:{"Content-Type":"application/json","X-WP-Nonce":P}}).then(e=>e.json()).then(e=>{x(!1),e.sent?(S((0,n.__)("Report sent successfully","bubuku-media-library")),w("")):M(e.message||(0,n.__)("Error sending the report","bubuku-media-library"))}).catch(()=>{x(!1),M((0,n.__)("Network error. Please try again.","bubuku-media-library"))})):M((0,n.__)("Invalid email format","bubuku-media-library"))},disabled:N||!v.trim()},(0,r.createElement)(b,null),N?(0,n.__)("Sending…","bubuku-media-library"):(0,n.__)("Send now","bubuku-media-library"))),(C||L)&&(0,r.createElement)("div",{className:"bbk-send-test__feedback"},C&&(0,r.createElement)("p",{className:"form-feedback form-feedback--success"},(0,r.createElement)(c,null),C),L&&(0,r.createElement)("p",{className:"form-feedback form-feedback--error"},(0,r.createElement)(m,null),L)),T&&(0,r.createElement)("div",{className:"bbk-preview-url"},(0,r.createElement)("span",{className:"bbk-preview-url__label"},(0,n.__)("Preview email in browser:","bubuku-media-library")),(0,r.createElement)("a",{href:T,target:"_blank",rel:"noreferrer",className:"bbk-preview-url__link"},(0,n.__)("Open preview →","bubuku-media-library")))),(0,r.createElement)("div",{className:"bk-card-footer"},(f||g)&&(0,r.createElement)("div",{className:"bk-card-footer__info"},f&&(0,r.createElement)("p",{className:"form-feedback form-feedback--success"},(0,r.createElement)(c,null),f),g&&(0,r.createElement)("p",{className:"form-feedback form-feedback--error"},(0,r.createElement)(m,null),g)),(0,r.createElement)("button",{type:"submit",form:"bbk-email-notifications-form",className:"bk-btn bk-btn-primary",disabled:_},(0,r.createElement)(u,null),_?(0,n.__)("Saving…","bubuku-media-library"):(0,n.__)("Save","bubuku-media-library"))))},p=e=>parseInt(String(e).replace(/\D/g,""),10)||0,_=({good:e,medium:t,bad:a})=>{const i=p(e),l=p(t),s=p(a),o=i+l+s,u=o>0?(s/o*100).toFixed(1):"0",c=[{key:"good",label:(0,n.__)("Good size","bubuku-media-library"),count:null!=e?e:0,variant:"good"},{key:"medium",label:(0,n.__)("Medium size","bubuku-media-library"),count:null!=t?t:0,variant:"medium"},{key:"bad",label:(0,n.__)("Large size","bubuku-media-library"),count:null!=a?a:0,variant:"bad"}];return(0,r.createElement)("div",{className:"bbk-size-summary"},(0,r.createElement)("div",{className:"bbk-size-tiles"},c.map(e=>(0,r.createElement)("div",{key:e.key,className:`bbk-size-tile bbk-size-tile--${e.variant}`},(0,r.createElement)("div",{className:"bbk-size-tile__number"},e.count),(0,r.createElement)("div",{className:"bbk-size-tile__label"},e.label)))),(0,r.createElement)("div",{className:"bbk-size-bar"},(0,r.createElement)("div",{className:"bbk-size-bar__track"},o>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"bbk-size-bar__segment bbk-size-bar__segment--good",style:{flex:i}}),(0,r.createElement)("div",{className:"bbk-size-bar__segment bbk-size-bar__segment--medium",style:{flex:l}}),(0,r.createElement)("div",{className:"bbk-size-bar__segment bbk-size-bar__segment--bad",style:{flex:s}}))),(0,r.createElement)("div",{className:"bbk-size-bar__footer"},(0,r.createElement)("span",{className:"bbk-size-bar__total"},(0,n.__)("Total:","bubuku-media-library")," ",(0,r.createElement)("strong",null,o.toLocaleString())," ",(0,n.__)("images analyzed","bubuku-media-library")),s>0&&(0,r.createElement)("span",{className:"bbk-size-bar__attention"},u,"% ",(0,n.__)("require attention","bubuku-media-library")))))},k=2*Math.PI*45,f=e=>parseInt(String(e).replace(/\D/g,""),10)||0,y=({altEmpty:e,total:t,withoutAlt:a,withAlt:i})=>{const l=f(null!=a?a:e),s=f(t),o=f(i),u=s>0?Math.min(l,s):l,c=o>0?o:Math.max(s-u,0),m=s>0?Math.min(l,s):0,d=s>0?Math.round(m/s*100):0,b=k*(1-d/100),h=(e=>e<10?"var(--green-500)":e<30?"var(--accent-dark)":"var(--red-500)")(d);return(0,r.createElement)("div",{className:"bbk-summary-alt-chart"},(0,r.createElement)("svg",{className:"bbk-summary-alt-chart__donut",width:"100",height:"100",viewBox:"0 0 100 100","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"50",cy:"50",r:45,fill:"none",stroke:"var(--border)",strokeWidth:"10"}),(0,r.createElement)("circle",{cx:"50",cy:"50",r:45,fill:"none",stroke:h,strokeWidth:"10",strokeDasharray:k,strokeDashoffset:b,strokeLinecap:"round",transform:"rotate(-90 50 50)"}),(0,r.createElement)("text",{x:"50",y:"46",textAnchor:"middle",dominantBaseline:"middle",fontSize:"16",fontWeight:"700",fill:h},d,"%"),(0,r.createElement)("text",{x:"50",y:"62",textAnchor:"middle",dominantBaseline:"middle",fontSize:"9",fill:"var(--text-muted)"},(0,n.__)("missing","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-summary-alt-chart__legend"},(0,r.createElement)("div",{className:"bbk-summary-alt-chart__legend-item"},(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-dot bbk-summary-alt-chart__legend-dot--missing"}),(0,n.__)("Without ALT","bubuku-media-library"),(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-value"},l.toLocaleString())),(0,r.createElement)("div",{className:"bbk-summary-alt-chart__legend-item"},(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-dot bbk-summary-alt-chart__legend-dot--present"}),(0,n.__)("With ALT","bubuku-media-library"),(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-value"},c.toLocaleString()))))},g=e=>parseInt(String(e).replace(/\D/g,""),10)||0,E=()=>(0,r.createElement)("div",{className:"bbk-summary-skeleton"},(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--full"}),(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--medium"}),(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--full"}),(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--short"})),v=()=>{const[e,t]=(0,i.useState)(""),[a,l]=(0,i.useState)(!1),[o,u]=(0,i.useState)(!0),[c,m]=(0,i.useState)(null),[d,b]=(0,i.useState)(!0),p=BbkMediaLibrary.api_url.endsWith("/")?BbkMediaLibrary.api_url.slice(0,-1):BbkMediaLibrary.api_url,k=`${p}/get-notification-settings`,f=`${p}/get-summary-stats`,v=BbkMediaLibrary._wpnonce;(0,i.useEffect)(()=>{fetch(k,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(e=>{t(e.data.emails),l(e.data.disabled),u(!1)})},[k,v]),(0,i.useEffect)(()=>{fetch(f,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(e=>{m(e),b(!1)}).catch(()=>{b(!1)})},[f]);let w=0;return c?.totals?.images_total?w=g(c.totals.images_total):c?.img_sizes&&(w=g(c.img_sizes.good)+g(c.img_sizes.medium)+g(c.img_sizes.bad)),(0,r.createElement)("div",{className:"bbk-dashboard"},(0,r.createElement)("div",{className:"bbk-summary-grid"},(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,r.createElement)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,r.createElement)("polyline",{points:"21 15 16 10 5 21"})),iconVariant:"icon-accent",title:(0,n.__)("Image Size","bubuku-media-library"),claim:(0,n.__)("Distribution by weight quality","bubuku-media-library"),animationDelay:".05s"},d?(0,r.createElement)(E,null):(0,r.createElement)(_,{good:c?.img_sizes?.good,medium:c?.img_sizes?.medium,bad:c?.img_sizes?.bad})),(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},(0,r.createElement)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,r.createElement)("circle",{cx:"12",cy:"12",r:"3"})),title:(0,n.__)("ALT Accessibility","bubuku-media-library"),claim:(0,n.__)("Images without alternative text","bubuku-media-library"),animationDelay:".1s"},d?(0,r.createElement)(E,null):(0,r.createElement)(y,{altEmpty:c?.img_alt_empty,total:w,withoutAlt:c?.totals?.without_alt,withAlt:c?.totals?.with_alt}))),!o&&(0,r.createElement)(h,{reportsEmails:e,reportsDisable:a}))},w=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"7 10 12 15 17 10"}),(0,r.createElement)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})),N=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),x=()=>{const[e,t]=(0,i.useState)("all"),[a,l]=(0,i.useState)("all"),[s,o]=(0,i.useState)(!1),[u,c]=(0,i.useState)(!1);let m=null;return m=u?(0,n.__)("Exporting…","bubuku-media-library"):s?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(N,null),(0,n.__)("Downloaded!","bubuku-media-library")):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(w,null),(0,n.__)("Export CSV","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-export-form"},(0,r.createElement)("div",{className:"bk-filters-grid"},(0,r.createElement)("div",{className:"bk-filter-group"},(0,r.createElement)("span",{className:"bk-filter-label"},(0,n.__)("Filter by ALT text","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-chip-group",role:"group","aria-label":(0,n.__)("Filter by ALT text","bubuku-media-library")},(0,r.createElement)("button",{type:"button",className:"bk-chip"+("all"===e?" bk-chip--active":""),onClick:()=>t("all"),"aria-pressed":"all"===e},(0,n.__)("All","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip"+("none"===e?" bk-chip--active":""),onClick:()=>t("none"),"aria-pressed":"none"===e},(0,n.__)("Without ALT","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip"+("some"===e?" bk-chip--active":""),onClick:()=>t("some"),"aria-pressed":"some"===e},(0,n.__)("With ALT","bubuku-media-library")))),(0,r.createElement)("div",{className:"bk-filter-group"},(0,r.createElement)("span",{className:"bk-filter-label"},(0,n.__)("Filter by size","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-chip-group",role:"group","aria-label":(0,n.__)("Filter by size","bubuku-media-library")},(0,r.createElement)("button",{type:"button",className:"bk-chip"+("all"===a?" bk-chip--active":""),onClick:()=>l("all"),"aria-pressed":"all"===a},(0,n.__)("All","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip bk-chip--good"+("good"===a?" bk-chip--active":""),onClick:()=>l("good"),"aria-pressed":"good"===a},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--good","aria-hidden":"true"}),(0,n.__)("Good","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip bk-chip--mid"+("mid"===a?" bk-chip--active":""),onClick:()=>l("mid"),"aria-pressed":"mid"===a},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--mid","aria-hidden":"true"}),(0,n.__)("Medium","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip bk-chip--bad"+("bad"===a?" bk-chip--active":""),onClick:()=>l("bad"),"aria-pressed":"bad"===a},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--bad","aria-hidden":"true"}),(0,n.__)("Bad","bubuku-media-library"))))),(0,r.createElement)("div",{className:"bk-size-legend"},(0,r.createElement)("div",{className:"bk-size-legend__item"},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--good","aria-hidden":"true"}),(0,r.createElement)("strong",{className:"bk-size-legend__label bk-size-legend__label--good"},(0,n.__)("Good","bubuku-media-library")),"< 100 KB"),(0,r.createElement)("div",{className:"bk-size-legend__item"},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--mid","aria-hidden":"true"}),(0,r.createElement)("strong",{className:"bk-size-legend__label bk-size-legend__label--mid"},(0,n.__)("Medium","bubuku-media-library")),"100–500 KB"),(0,r.createElement)("div",{className:"bk-size-legend__item"},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--bad","aria-hidden":"true"}),(0,r.createElement)("strong",{className:"bk-size-legend__label bk-size-legend__label--bad"},(0,n.__)("Bad","bubuku-media-library")),"> 500 KB")),(0,r.createElement)("div",{className:"bk-card-footer"},(0,r.createElement)("p",{className:"bk-card-footer__info bk-export-count"},(0,n.__)("Exporting","bubuku-media-library")," ",(0,r.createElement)("strong",null,(()=>{if("all"===e&&"all"===a)return(0,n.__)("all files","bubuku-media-library");const t=[];if("all"!==e&&t.push("none"===e?(0,n.__)("without ALT","bubuku-media-library"):(0,n.__)("with ALT","bubuku-media-library")),"all"!==a){const e={good:(0,n.__)("Good (< 100 KB)","bubuku-media-library"),mid:(0,n.__)("Medium (100–500 KB)","bubuku-media-library"),bad:(0,n.__)("Bad (> 500 KB)","bubuku-media-library")};t.push(e[a])}return t.join(", ")})())),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-primary",onClick:async()=>{c(!0);try{var t;const r=new URLSearchParams({alt_filter:e,size_filter:a}),i=await fetch(`${BbkMediaLibrary.api_url}/export-csv?${r}`,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}});if(!i.ok)throw new Error(`Error ${i.status}: ${i.statusText}`);const n=(null!==(t=i.headers.get("Content-Disposition"))&&void 0!==t?t:"").match(/filename="([^"]+)"/),l=n?n[1]:`media-library-export-${(new Date).toISOString().slice(0,10)}.csv`,s=await i.blob(),u=URL.createObjectURL(s),c=Object.assign(document.createElement("a"),{href:u,download:l});document.body.appendChild(c),c.click(),c.remove(),URL.revokeObjectURL(u),o(!0),setTimeout(()=>o(!1),3e3)}catch(e){console.error("CSV export failed:",e)}finally{c(!1)}},disabled:u},m)))};var C=a(809),S=a.n(C);const L={UPDATED:"updated",UNCHANGED:"unchanged",CLEARED:"cleared",REJECTED:"rejected",SKIPPED_PERMISSION:"skipped_permission",OVERWRITTEN_DUPLICATE:"overwritten_duplicate",NOT_APPLIED:"not_applied",UNCONFIRMED:"unconfirmed"},M=[L.REJECTED,L.SKIPPED_PERMISSION,L.NOT_APPLIED,L.UNCONFIRMED],T=Object.values(L),D=["Source Row","Import Status","Import Reason"],R=e=>{const{status:t,reason:a,supersededBy:r}=e;if(t===L.OVERWRITTEN_DUPLICATE&&r)return(0,n.sprintf)(/* translators: %d: CSV row number */ /* translators: %d: CSV row number */ 2 (0,n.__)("Same ID as row %d, which is imported instead.","bubuku-media-library"),r);if(t===L.CLEARED)return(0,n.__)("The CSV had an empty ALT text, so the existing one was removed.","bubuku-media-library");if(t===L.SKIPPED_PERMISSION)return(0,n.__)("You are not allowed to edit this attachment.","bubuku-media-library");switch(a){case"invalid_id":return(0,n.__)("The ID is missing or not a number.","bubuku-media-library");case"not_attachment":return(0,n.__)("No attachment exists with this ID.","bubuku-media-library");case"invalid_alt":return(0,n.__)("The Alt Text value is missing.","bubuku-media-library");case"write_failed":return(0,n.__)("The ALT text could not be saved.","bubuku-media-library");case"http_429":return(0,n.__)("The server was busy and rejected the batch repeatedly.","bubuku-media-library");case"http_401":case"http_403":return(0,n.__)("The session expired or you do not have permission. Reload the page and try again.","bubuku-media-library");case"network_error":return(0,n.__)("The connection failed; the server may have applied this row.","bubuku-media-library");case"invalid_response":return(0,n.__)("The server response could not be read; the server may have applied this row.","bubuku-media-library");default:return/^http_5/.test(a||"")?(0,n.__)("The server failed to answer; it may have applied this row.","bubuku-media-library"):/^http_4/.test(a||"")?(0,n.__)("The server rejected the batch.","bubuku-media-library"):a||""}},z=e=>new Promise(t=>{setTimeout(t,e)}),A=e=>{const t=String(null!=e?e:"").trim();return/^\d+$/.test(t)?Number(t):0},O=async({apiUrl:e,nonce:t,rows:a,retryDelayMs:r=2e3,onRetry:i})=>{let n,l;for(let l=0;;l++){try{n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":t},body:JSON.stringify({rows:a})})}catch(e){return{kind:L.UNCONFIRMED,reason:"network_error"}}if(429!==n.status||l>=3)break;i&&i(l+1),await z(r*(l+1))}if(n.status>=400&&n.status<500)return{kind:L.NOT_APPLIED,reason:`http_${n.status}`};if(!n.ok)return{kind:L.UNCONFIRMED,reason:`http_${n.status}`};try{l=await n.json()}catch(e){return{kind:L.UNCONFIRMED,reason:"invalid_response"}}const s=l?.data?.results;return l?.success&&Array.isArray(s)&&s.length===a.length?{kind:"ok",results:s}:{kind:L.UNCONFIRMED,reason:"invalid_response"}},I=(e,t)=>{var a,r;return{recordNumber:e.recordNumber,id:null!==(a=e.data.ID)&&void 0!==a?a:"",alt:null!==(r=e.data["Alt Text"])&&void 0!==r?r:"",original:e.data,...t}},P=e=>{const t=Object.fromEntries(T.map(e=>[e,0]));return e.forEach(e=>{t[e.status]+=1}),t},B=e=>D.map(t=>{let a=t;for(;e.includes(a);)a=`${a}_`;return a});let j=null;const W=()=>j,U=e=>{j=e},F=[L.UPDATED,L.UNCHANGED],$=({report:e})=>{const[t,a]=(0,i.useState)(100),{counts:l,pending:s}=e,o=e.results.filter(e=>!F.includes(e.status)),u=s.length>0,c=u?(0,n.sprintf)(/* translators: %d: number of pending rows */ /* translators: %d: number of pending rows */ 3 (0,n._n)("%d row needs attention","%d rows need attention",s.length,"bubuku-media-library"),s.length):(0,n.__)("Import complete","bubuku-media-library"),m=[l[L.UPDATED]>0&&(0,n.sprintf)(/* translators: %d: number of updated ALT texts */ /* translators: %d: number of updated ALT texts */ 4 (0,n.__)("%d updated","bubuku-media-library"),l[L.UPDATED]),l[L.CLEARED]>0&&(0,n.sprintf)(/* translators: %d: number of ALT texts that were emptied */ /* translators: %d: number of ALT texts that were emptied */ 5 (0,n.__)("%d cleared","bubuku-media-library"),l[L.CLEARED]),l[L.UNCHANGED]>0&&(0,n.sprintf)(/* translators: %d: number of ALT texts that already had that value */ /* translators: %d: number of ALT texts that already had that value */ 6 (0,n.__)("%d unchanged","bubuku-media-library"),l[L.UNCHANGED])].filter(Boolean).join(", "),d=(0,n.__)("Review the pending rows below, or download them, fix them and import the file again.","bubuku-media-library");let b=m?`${m}.`:"";return u&&(b=m?(0,n.sprintf)(/* translators: 1: summary such as "182 updated, 14 unchanged", 2: what to do with the pending rows */ /* translators: 1: summary such as "182 updated, 14 unchanged", 2: what to do with the pending rows */ 7 (0,n.__)("%1$s. %2$s","bubuku-media-library"),m,d):d),(0,r.createElement)("section",{className:"bbk-import-report"},(0,r.createElement)("div",{className:"bbk-import-report__head"},(0,r.createElement)("div",{role:"status"},(0,r.createElement)("h3",{className:"bbk-import-report__title bbk-import-report__title--"+(u?"attention":"ok")},c),(0,r.createElement)("p",{className:"bbk-import-report__lead"},b)),u&&(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bbk-import-report__download",onClick:()=>{((e,t)=>{const a=new Blob([e],{type:"text/csv;charset=utf-8"}),r=URL.createObjectURL(a),i=document.createElement("a");i.href=r,i.download=t,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),0)})((e=>{const t=e.fields,a=e.pending.map(e=>[...t.map(t=>(e=>{const t=String(null!=e?e:"");return/^'?[=+\-@\t\r]/.test(t)?`'${t}`:t})(e.original[t])),e.recordNumber,e.status,R(e)]);return`\ufeff${S().unparse({fields:[...t,...B(t)],data:a},{delimiter:",",newline:"\r\n"})}`})(e),`${(e.fileName||"alt-import").replace(/\.csv$/i,"")}-pending.csv`)}},(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"7 10 12 15 17 10"}),(0,r.createElement)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})),(0,n.__)("Download pending rows CSV","bubuku-media-library"))),e.normalized>0&&(0,r.createElement)("p",{className:"bbk-import-report__note"},(0,n.sprintf)(/* translators: %d: number of ALT texts changed by sanitization */ /* translators: %d: number of ALT texts changed by sanitization */ 8 (0,n._n)("%d ALT text was normalized (HTML tags or extra whitespace removed) before saving.","%d ALT texts were normalized (HTML tags or extra whitespace removed) before saving.",e.normalized,"bubuku-media-library"),e.normalized)),l[L.UNCONFIRMED]>0&&(0,r.createElement)("p",{className:"bbk-import-report__warning"},(0,n.__)("Unconfirmed rows: the connection failed before the response arrived, so the server may have applied them. Check those images before importing them again.","bubuku-media-library")),o.length>0&&(0,r.createElement)("details",{className:"bbk-import-report__details"},(0,r.createElement)("summary",null,(0,n.sprintf)(/* translators: %d: number of rows listed in the detail */ /* translators: %d: number of rows listed in the detail */ 9 (0,n._n)("Details of %d affected row","Details of %d affected rows",o.length,"bubuku-media-library"),o.length)),(0,r.createElement)("div",{className:"bbk-import-report__table-wrap",role:"region",tabIndex:0,"aria-label":(0,n.__)("Affected rows","bubuku-media-library")},(0,r.createElement)("table",{className:"bbk-import-report__table"},(0,r.createElement)("thead",null,(0,r.createElement)("tr",null,(0,r.createElement)("th",{scope:"col"},(0,n.__)("Row","bubuku-media-library")),(0,r.createElement)("th",{scope:"col"},(0,n.__)("ID","bubuku-media-library")),(0,r.createElement)("th",{scope:"col"},(0,n.__)("Alt Text","bubuku-media-library")),(0,r.createElement)("th",{scope:"col"},(0,n.__)("Status","bubuku-media-library")),(0,r.createElement)("th",{scope:"col"},(0,n.__)("Reason","bubuku-media-library")))),(0,r.createElement)("tbody",null,o.slice(0,t).map(e=>{return(0,r.createElement)("tr",{key:e.recordNumber},(0,r.createElement)("td",null,e.recordNumber),(0,r.createElement)("td",null,e.id),(0,r.createElement)("td",{className:"bbk-import-report__alt"},""===e.alt?(0,r.createElement)("em",{className:"bbk-import-report__empty"},(0,n.__)("(empty)","bubuku-media-library")):e.alt),(0,r.createElement)("td",null,(0,r.createElement)("span",{className:"bbk-import-report__status bbk-import-report__status--"+(t=e.status,[L.UPDATED,L.CLEARED,L.UNCHANGED].includes(t)?"ok":t===L.OVERWRITTEN_DUPLICATE?"neutral":"bad")},(e=>{switch(e){case L.UPDATED:return(0,n.__)("Updated","bubuku-media-library");case L.CLEARED:return(0,n.__)("ALT cleared","bubuku-media-library");case L.UNCHANGED:return(0,n.__)("Unchanged","bubuku-media-library");case L.REJECTED:return(0,n.__)("Rejected","bubuku-media-library");case L.SKIPPED_PERMISSION:return(0,n.__)("Skipped (no permission)","bubuku-media-library");case L.OVERWRITTEN_DUPLICATE:return(0,n.__)("Replaced by a later row","bubuku-media-library");case L.NOT_APPLIED:return(0,n.__)("Not applied (safe to retry)","bubuku-media-library");case L.UNCONFIRMED:return(0,n.__)("Unconfirmed result","bubuku-media-library");default:return e}})(e.status))),(0,r.createElement)("td",{className:"bbk-import-report__reason"},R(e)));var t})))),o.length>t&&(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bbk-import-report__more",onClick:()=>a(t+100)},(0,n.sprintf)(/* translators: %1$d: rows shown, %2$d: total affected rows */ /* translators: %1$d: rows shown, %2$d: total affected rows */ 10 (0,n.__)("Show more (%1$d of %2$d)","bubuku-media-library"),t,o.length))))},H=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.createElement)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),V=()=>{const[e,t]=(0,i.useState)(null),[a,l]=(0,i.useState)(!1),[s,o]=(0,i.useState)(null),[u,c]=(0,i.useState)(""),[m,d]=(0,i.useState)(W),[b,h]=(0,i.useState)(!1),p=(0,i.useRef)(null),_=`${BbkMediaLibrary.api_url}/import-alt-chunk`,k=BbkMediaLibrary.rest_nonce,f=["ID","Alt Text"],y=e=>{var t;return(null!==(t=e?.name)&&void 0!==t?t:"").toLowerCase().endsWith(".csv")},g=()=>{p.current&&p.current.click()},E=s?Math.round((s.done?s.chunk:s.chunk-1)/s.totalChunks*100):0;let v=(0,n.__)("Processing…","bubuku-media-library");return s&&s.chunk>0&&(v=s.retry>0?(0,n.sprintf)(/* translators: %1$d: current batch, %2$d: total batches, %3$d: retry number, %4$d: max retries */ /* translators: %1$d: current batch, %2$d: total batches, %3$d: retry number, %4$d: max retries */ 11 (0,n.__)("Batch %1$d of %2$d: server busy, retrying (%3$d/%4$d)…","bubuku-media-library"),s.chunk,s.totalChunks,s.retry,3):(0,n.sprintf)(/* translators: %1$d: current batch, %2$d: total batches, %3$d: progress percentage */ /* translators: %1$d: current batch, %2$d: total batches, %3$d: progress percentage */ 12 (0,n.__)("Batch %1$d of %2$d (%3$d%%)…","bubuku-media-library"),s.chunk,s.totalChunks,E)),(0,r.createElement)("form",{id:"bbk-import-alt-form",onSubmit:async a=>{if(a.preventDefault(),!e)return void c((0,n.__)("Please select a CSV file.","bubuku-media-library"));let r;l(!0),c("");try{r=await(e=>new Promise((t,a)=>{S().parse(e,{header:!0,skipEmptyLines:!1,complete:t,error:a})}))(e)}catch(e){return l(!1),void c((0,n.sprintf)(/* translators: %s: error message */ /* translators: %s: error message */ 13 (0,n.__)("Failed to parse CSV: %s","bubuku-media-library"),e.message))}const i=r.meta.fields||[],s=f.filter(e=>!i.includes(e));if(s.length>0)return l(!1),void c((0,n.sprintf)(/* translators: %s: comma-separated list of missing column names */ /* translators: %s: comma-separated list of missing column names */ 14 (0,n.__)("Invalid CSV structure. Missing required columns: %s","bubuku-media-library"),s.join(", ")));const u=((e=[])=>{const t=e.filter(e=>"Quotes"===e.type),a=t.filter(e=>Number.isInteger(e.row)).map(e=>e.row+1);return{blocked:t.length>0,rows:[...new Set(a)].sort((e,t)=>e-t)}})(r.errors);if(u.blocked)return l(!1),void c(u.rows.length>0?(0,n.sprintf)(/* translators: %s: comma-separated row numbers */ /* translators: %s: comma-separated row numbers */ 15 (0,n.__)("The CSV has malformed quoted fields (near row %s), so it cannot be read reliably. Nothing was imported. Fix the file and try again.","bubuku-media-library"),u.rows.slice(0,5).join(", ")):(0,n.__)("The CSV has malformed quoted fields, so it cannot be read reliably. Nothing was imported. Fix the file and try again.","bubuku-media-library"));const m=r.data.map((e,t)=>({recordNumber:t+2,data:e})).filter(e=>{return t=e.data,!Object.values(t).every(e=>""===String(null!=e?e:"").trim());var t});if(0===m.length)return l(!1),void c((0,n.__)("The CSV file is empty.","bubuku-media-library"));d(null),U(null),o({chunk:0,totalChunks:1,retry:0});try{const t=await(async({records:e,apiUrl:t,nonce:a,chunkSize:r=100,retryDelayMs:i,onProgress:n})=>{const l=(e=>{const t=new Map;e.forEach(e=>{const a=A(e.data.ID);a>0&&t.set(a,e.recordNumber)});const a=new Map;return e.forEach(e=>{const r=A(e.data.ID),i=r>0?t.get(r):void 0;void 0!==i&&i!==e.recordNumber&&a.set(e.recordNumber,i)}),a})(e),s=[],o=[];e.forEach(e=>{l.has(e.recordNumber)?s.push(I(e,{status:L.OVERWRITTEN_DUPLICATE,supersededBy:l.get(e.recordNumber)})):o.push(e)});const u=Math.ceil(o.length/r);for(let e=0;e<u;e++){const l=o.slice(e*r,(e+1)*r),c=(t=0)=>n&&n({chunk:e+1,totalChunks:u,retry:t});c();const m=await O({apiUrl:t,nonce:a,retryDelayMs:i,rows:l.map(e=>({ID:e.data.ID,"Alt Text":e.data["Alt Text"]})),onRetry:c});l.forEach((e,t)=>{if("ok"!==m.kind)return void s.push(I(e,{status:m.kind,reason:m.reason}));const a=m.results[t]||{};T.includes(a.status)?s.push(I(e,{status:a.status,reason:a.reason,normalized:Boolean(a.normalized)})):s.push(I(e,{status:L.UNCONFIRMED,reason:"invalid_response"}))}),n&&n({chunk:e+1,totalChunks:u,retry:0,done:!0})}return s.sort((e,t)=>e.recordNumber-t.recordNumber),s})({records:m,apiUrl:_,nonce:k,onProgress:o}),a=(({fileName:e,fields:t,results:a})=>({fileName:e,fields:t,results:a,counts:P(a),normalized:a.filter(e=>e.normalized).length,pending:a.filter(e=>M.includes(e.status))}))({fileName:e.name,fields:i,results:t});U(a),d(a)}catch(e){console.error("Import failed:",e),c((0,n.__)("The import could not be completed.","bubuku-media-library"))}l(!1),o(null),t(null),p.current&&(p.current.value="")}},(0,r.createElement)("div",{className:"upload-zone"+(b?" upload-zone--dragging":""),id:"import-zone",onClick:g,onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.preventDefault(),h(!1)},onDrop:e=>{e.preventDefault(),h(!1);const a=e.dataTransfer.files[0]||null;if(a){if(!y(a))return void c((0,n.__)("Only .CSV files are accepted.","bubuku-media-library"));t(a),c("")}},onKeyDown:e=>"Enter"===e.key&&g(),role:"button",tabIndex:0,"aria-label":(0,n.__)("Click to select or drag a CSV file here","bubuku-media-library")},(0,r.createElement)("input",{ref:p,type:"file",id:"import-file",name:"csv_file",accept:".csv",onChange:e=>{const a=e.target.files[0]||null;if(a&&!y(a))return c((0,n.__)("Only .CSV files are accepted.","bubuku-media-library")),void(e.target.value="");t(a),c("")},disabled:a,style:{display:"none"}}),(0,r.createElement)("div",{className:"upload-zone-icon"},(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.createElement)("polyline",{points:"14 2 14 8 20 8"}),(0,r.createElement)("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),(0,r.createElement)("line",{x1:"9",y1:"15",x2:"15",y2:"15"}))),(0,r.createElement)("p",null,(0,r.createElement)("strong",null,(0,n.__)("Click to select","bubuku-media-library"))," ",(0,n.__)("or drag your file here","bubuku-media-library")),(0,r.createElement)("p",{className:"upload-hint"},(0,n.__)("Only .CSV files","bubuku-media-library"))),(0,r.createElement)("div",{className:"bk-card-footer"},(e||a&&s||u)&&(0,r.createElement)("div",{className:"bk-card-footer__info"},e&&(0,r.createElement)("div",{className:"file-selected",id:"import-selected"},(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),(0,r.createElement)("span",null,(0,n.__)("Selected file:","bubuku-media-library")," ",(0,r.createElement)("span",{className:"file-name"},e.name))),a&&s&&(0,r.createElement)("div",{className:"bk-progress-bar"},(0,r.createElement)("div",{className:"bk-progress-bar__track"},(0,r.createElement)("div",{className:"bk-progress-bar__fill",style:{width:`${E}%`}})),(0,r.createElement)("span",{className:"bk-progress-bar__label",role:"status"},v)),u&&(0,r.createElement)("p",{className:"bbk-notice bbk-notice--error"},(0,r.createElement)(H,null),u)),(0,r.createElement)("button",{type:"submit",className:"bk-btn bk-btn-primary",id:"import-btn",disabled:a||!e},(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"17 8 12 3 7 8"}),(0,r.createElement)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),a?(0,n.__)("Importing…","bubuku-media-library"):(0,n.__)("Import ALT text","bubuku-media-library"))),m&&(0,r.createElement)($,{report:m}))},q=()=>(0,r.createElement)("div",{className:"bbk-dashboard"},(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"7 10 12 15 17 10"}),(0,r.createElement)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})),title:(0,n.__)("Export ALT text to CSV","bubuku-media-library"),claim:(0,n.__)("Download a CSV with image data filtered by your selection","bubuku-media-library"),animationDelay:".05s"},(0,r.createElement)(x,null)),(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"17 8 12 3 7 8"}),(0,r.createElement)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),title:(0,n.__)("Import ALT text from CSV","bubuku-media-library"),claim:(0,n.__)("Upload the exported CSV file to update the ALT text of the images","bubuku-media-library"),animationDelay:".1s"},(0,r.createElement)(V,null))),K='This image file size is too large to upload. To reduce the file size, go to: <a href="https://squoosh.app/" target="_blank" rel="noopener noreferrer">https://squoosh.app/</a> , upload your image and on the controls select <strong>AVIF</strong> under the heading Compress, and set the quality to 80 or above. Download, and upload this new file.',G={enabled:!1,max_size_mb:1,message:K,image_id:0,image_url:"",image_alt:""},J=e=>{if(!e||!e.success||!e.data)return null;const t=e.data;return{enabled:Boolean(t.enabled),max_size_mb:Number(t.max_size_mb)||G.max_size_mb,message:"string"==typeof t.message&&""!==t.message?t.message:K,image_id:Number(t.image_id)||0,image_url:"string"==typeof t.image_url?t.image_url:"",image_alt:"string"==typeof t.image_alt?t.image_alt:""}},X=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"17 8 12 3 7 8"}),(0,r.createElement)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),Z=()=>{const[e,t]=(0,i.useState)(!0),[a,l]=(0,i.useState)(!1),[o,u]=(0,i.useState)(""),[c,m]=(0,i.useState)(""),[d,b]=(0,i.useState)(G),h=(0,i.useRef)(null),p=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/get-upload-limit-settings`,[]),_=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/set-upload-limit-settings`,[]);(0,i.useEffect)(()=>{fetch(p,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(e=>{const a=J(e);a&&b(a),t(!1)}).catch(()=>{u((0,n.__)("Could not load upload limit settings. Please refresh and try again.","bubuku-media-library")),t(!1)})},[p]);const k=(e,t)=>{b(a=>({...a,[e]:t}))},f=!d.enabled;return(0,r.createElement)(s,{title:(0,n.__)("Upload size limit","bubuku-media-library"),claim:(0,n.__)("Block images above a configurable size before they reach the library.","bubuku-media-library"),icon:(0,r.createElement)(X,null),animationDelay:".08s"},(0,r.createElement)("div",{className:"bbk-upload-limit-card"},e&&(0,r.createElement)("p",{className:"bbk-tools-placeholder"},(0,n.__)("Loading upload limit settings…","bubuku-media-library")),!e&&o&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--error"},o),!e&&c&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--success"},c),!e&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"bbk-upload-limit-layout"},(0,r.createElement)("div",{className:"bbk-upload-limit-row bbk-upload-limit-row--toggle"},(0,r.createElement)("label",{className:"bbk-tools-toggle",htmlFor:"bbk-upload-limit-enabled","aria-label":(0,n.__)("Enable upload size limit","bubuku-media-library")},(0,r.createElement)("input",{id:"bbk-upload-limit-enabled",type:"checkbox",checked:d.enabled,onChange:e=>k("enabled",e.target.checked)})),(0,r.createElement)("div",{className:"bbk-upload-limit-row-text"},(0,r.createElement)("strong",null,(0,n.__)("Block oversized image uploads","bubuku-media-library")),(0,r.createElement)("p",null,(0,n.__)("Applies to every role, administrators included. Only image files are affected.","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--size"},(0,r.createElement)("label",{htmlFor:"bbk-upload-limit-max-size"},(0,n.__)("Maximum size","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-max-size-input"},(0,r.createElement)("input",{id:"bbk-upload-limit-max-size",type:"number",step:"0.1",min:"0.1",max:"64",disabled:f,value:d.max_size_mb,onChange:e=>k("max_size_mb",""===e.target.value?"":Number(e.target.value))}),(0,r.createElement)("span",null,(0,n.__)("MB","bubuku-media-library"))),(0,r.createElement)("p",{className:"bbk-upload-limit-hint"},(0,n.__)("Only applies to image files (image/*).","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--message"},(0,r.createElement)("div",{className:"bbk-upload-limit-field-header"},(0,r.createElement)("label",{htmlFor:"bbk-upload-limit-message"},(0,n.__)("Message shown to editors","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",disabled:f,onClick:()=>{k("message",K)}},(0,n.__)("Restore default message","bubuku-media-library"))),(0,r.createElement)("textarea",{id:"bbk-upload-limit-message",rows:"8",className:"bbk-upload-limit-message-input",disabled:f,value:d.message,onChange:e=>k("message",e.target.value)}),(0,r.createElement)("p",{className:"bbk-upload-limit-hint"},(0,n.__)("Allowed tags: a, strong, b, em, i, br, p, ul, ol, li, code, span.","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--image"},(0,r.createElement)("span",{className:"bbk-upload-limit-field-label"},(0,n.__)("Supporting image","bubuku-media-library")),d.image_url?(0,r.createElement)("div",{className:"bbk-upload-limit-image-preview"},(0,r.createElement)("img",{src:d.image_url,alt:d.image_alt})):(0,r.createElement)("p",{className:"bbk-upload-limit-hint"},(0,n.__)("No image selected.","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-image-actions"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",disabled:f,onClick:()=>{"undefined"!=typeof wp&&wp.media&&(h.current||(h.current=wp.media({title:(0,n.__)("Select an image","bubuku-media-library"),library:{type:"image"},multiple:!1}),h.current.on("select",()=>{const e=h.current.state().get("selection"),t=e?e.first():null;if(!t)return;const a=t.toJSON();b(e=>({...e,image_id:a.id,image_url:a.sizes?.large?.url||a.url,image_alt:a.alt||""}))})),h.current.open())}},d.image_url?(0,n.__)("Replace image","bubuku-media-library"):(0,n.__)("Select image","bubuku-media-library")),d.image_url&&(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",disabled:f,onClick:()=>{b(e=>({...e,image_id:0,image_url:"",image_alt:""}))}},(0,n.__)("Remove","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--preview"},(0,r.createElement)("span",{className:"bbk-upload-limit-field-label"},(0,n.__)("Preview","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-mock-overlay","aria-hidden":"true"},(0,r.createElement)("div",{className:"bbk-upload-limit-mock-dialog"},(0,r.createElement)("span",{className:"bbk-upload-limit-mock-close"},"×"),(0,r.createElement)("h3",{className:"bbk-upload-limit-mock-title"},(0,n.__)("Image too large","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-mock-body",dangerouslySetInnerHTML:{__html:d.message}}),(0,r.createElement)("ul",{className:"bbk-upload-limit-mock-files"},(0,r.createElement)("li",null,"example-photo.jpg"," ",(0,r.createElement)("span",{className:"bbk-upload-limit-mock-file-size"},"(2.4 MB)"))),d.image_url&&(0,r.createElement)("img",{className:"bbk-upload-limit-mock-image",src:d.image_url,alt:""}))))),(0,r.createElement)("div",{className:"bbk-tools-actions"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-primary",onClick:()=>{l(!0),u(""),m(""),fetch(_,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":BbkMediaLibrary.rest_nonce},body:JSON.stringify({enabled:d.enabled,max_size_mb:""===d.max_size_mb?0:Number(d.max_size_mb),message:d.message,image_id:d.image_id})}).then(e=>e.json()).then(e=>{if(l(!1),!e||!e.success)return void u((0,n.__)("Could not save upload limit settings. Please try again.","bubuku-media-library"));const t=J(e);t&&b(t),m((0,n.__)("Upload limit settings saved.","bubuku-media-library"))}).catch(()=>{l(!1),u((0,n.__)("A network error occurred while saving. Please try again.","bubuku-media-library"))})},disabled:a},a?(0,n.__)("Saving…","bubuku-media-library"):(0,n.__)("Save upload limit settings","bubuku-media-library"))))))},Q=()=>(0,r.createElement)("div",{className:"bbk-dashboard"},(0,r.createElement)(Z,null)),Y=(document.documentElement.lang||"en").toLowerCase();function ee(e,t){const a=new URLSearchParams({utm_source:"bml-plugin",utm_medium:"wp-admin-footer",utm_campaign:"bml-plugin-footer-links",utm_content:t+"-"+Y});return e+(e.includes("?")?"&":"?")+a.toString()}const te=[{href:ee("https://www.bubuku.com/blog/anadir-texto-alternativo-wordpress/","article-add-alt-text"),label:(0,n.__)("How to add alternative text to images in WordPress for better SEO and accessibility","bubuku-media-library")},{href:ee("https://www.bubuku.com/blog/alt-text-wpml-csv/","article-alt-text-csv-wpml"),label:(0,n.__)("How to export and import alternative text in WordPress with WPML and CSV files","bubuku-media-library")},{href:ee("https://www.bubuku.com/blog/cambiar-imagenes-wordpress/","article-update-images"),label:(0,n.__)("How to change or update images in WordPress without impacting performance","bubuku-media-library")},{href:ee("https://www.bubuku.com/blog/solucion-sizes-auto-wordpress/","article-sizes-auto"),label:(0,n.__)('How to solve problems with the sizes="auto" attribute in WordPress',"bubuku-media-library")},{href:ee("https://www.bubuku.com/blog/optimizacion-carga-imagenes-wordpress/","article-optimize-image-loading"),label:(0,n.__)("How to optimize image loading in WordPress for better performance and Core Web Vitals","bubuku-media-library")}],ae=[{label:(0,n.__)("Business-driven custom WordPress development","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"}))},{label:(0,n.__)("Plugins and external systems integrations","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),(0,r.createElement)("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"}))},{label:(0,n.__)("Continuous maintenance and support","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"23 4 23 10 17 10"}),(0,r.createElement)("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"}))},{label:(0,n.__)("Performance and conversion rate optimization","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),(0,r.createElement)("polyline",{points:"17 6 23 6 23 12"}))},{label:(0,n.__)("Technical implementation and integrations","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"12",cy:"12",r:"3"}),(0,r.createElement)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"}))}];function re(){return(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.createElement)("polyline",{points:"14 2 14 8 20 8"}),(0,r.createElement)("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),(0,r.createElement)("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),(0,r.createElement)("polyline",{points:"10 9 9 9 8 9"}))}function ie(){return(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"}))}function ne(){return(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,r.createElement)("polyline",{points:"12 5 19 12 12 19"}))}const le=ee("https://www.bubuku.com/servicios/","cta-services"),se=function(){return(0,r.createElement)("footer",{className:"bk-footer-main"},(0,r.createElement)("div",{className:"bk-footer-main__inner"},(0,r.createElement)("div",{className:"bk-footer-main__resources"},(0,r.createElement)("div",{className:"bk-footer-main__section-title"},(0,r.createElement)("div",{className:"bk-footer-main__icon"},(0,r.createElement)(re,null)),(0,r.createElement)("p",{className:"bk-footer-main__heading"},(0,n.__)("Useful resources on image optimization (Spanish guides)","bubuku-media-library"))),(0,r.createElement)("p",{className:"bk-footer-main__description"},(0,n.__)("We've compiled some practical articles that can help you improve image loading and management in WordPress.","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-footer-main__divider"}),(0,r.createElement)("ul",{className:"bk-footer-main__links"},te.map((e,t)=>(0,r.createElement)("li",{key:t},(0,r.createElement)(re,null),(0,r.createElement)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer"},e.label))))),(0,r.createElement)("div",{className:"bk-footer-main__team"},(0,r.createElement)("div",{className:"bk-footer-main__team-title"},(0,r.createElement)("div",{className:"bk-footer-main__icon"},(0,r.createElement)(ie,null)),(0,r.createElement)("p",{className:"bk-footer-main__team-heading"},(0,n.__)("Technical partner for your WordPress projects","bubuku-media-library"))),(0,r.createElement)("p",{className:"bk-footer-main__team-description"},(0,n.__)("We work alongside marketing and business teams to improve the stability, performance, and evolution of your WordPress projects.","bubuku-media-library")),(0,r.createElement)("ul",{className:"bk-footer-main__services"},ae.map((e,t)=>(0,r.createElement)("li",{key:t},e.icon,(0,r.createElement)("span",null,e.label)))),(0,r.createElement)("a",{href:le,target:"_blank",rel:"noopener noreferrer",className:"bk-footer-main__cta"},(0,n.__)("See how we work","bubuku-media-library"),(0,r.createElement)(ne,null)))))},oe=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,r.createElement)("path",{d:"M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4"}),(0,r.createElement)("path",{d:"M12 2v2"}),(0,r.createElement)("path",{d:"M9 12v9"}),(0,r.createElement)("path",{d:"M15 12v9"}),(0,r.createElement)("path",{d:"M5 16l4 -2"}),(0,r.createElement)("path",{d:"M15 14l4 2"}),(0,r.createElement)("path",{d:"M9 18h6"}),(0,r.createElement)("path",{d:"M10 8v.01"}),(0,r.createElement)("path",{d:"M14 8v.01"})),ue=({animationDelay:e=".18s",showManageAction:t=!1,onManageTools:a=null})=>{const i=BbkMediaLibrary&&BbkMediaLibrary.mcp_server_url?String(BbkMediaLibrary.mcp_server_url):"",l=BbkMediaLibrary&&BbkMediaLibrary.profile_app_passwords_url?String(BbkMediaLibrary.profile_app_passwords_url):"/wp-admin/profile.php#application-passwords-section",o=i.trim().length>0,[u,c]=wp.element.useState(""),m=`{\n "mcpServers": {\n "bubuku-media-library": {\n "command": "npx",\n "args": [\n "-y",\n "mcp-remote",\n "${i}",\n "--header",\n "Authorization: Basic BASE64_OF_USER_AND_APP_PASSWORD"\n ]\n }\n }\n}`,d=async(e,t)=>{if(e)try{await navigator.clipboard.writeText(e),c(t),window.setTimeout(()=>{c(e=>e===t?"":e)},1800)}catch(e){c("")}},b=(0,r.createElement)("span",{className:"bbk-mcp-header-status "+(o?"is-active":"is-inactive")},o?(0,n.__)("Active","bubuku-media-library"):(0,n.__)("Inactive","bubuku-media-library"));return(0,r.createElement)(s,{icon:(0,r.createElement)(oe,null),title:(0,n.__)("MCP Server","bubuku-media-library"),claim:(0,n.__)("Expose plugin abilities through one MCP server URL","bubuku-media-library"),headerMeta:b,animationDelay:e},(0,r.createElement)("div",{className:"bbk-agent-api-card"},(0,r.createElement)("div",{className:"bbk-mcp-url-block"},(0,r.createElement)("div",{className:"bbk-mcp-url-row"},(0,r.createElement)("span",{className:"bbk-mcp-url-value"},i||(0,n.__)("Unavailable","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>d(i,"server-url"),disabled:!i},"server-url"===u?(0,n.__)("Copied","bubuku-media-library"):(0,n.__)("Copy","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-mcp-divider","aria-hidden":"true"}),(0,r.createElement)("details",{className:"bbk-mcp-summary"},(0,r.createElement)("summary",null,(0,r.createElement)("span",{className:"bbk-mcp-summary-chevron","aria-hidden":"true"},(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},(0,r.createElement)("polyline",{points:"9 18 15 12 9 6"}))),(0,n.__)("Configure in Claude Desktop","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-mcp-summary__content"},(0,r.createElement)("ol",{className:"bbk-mcp-steps"},(0,r.createElement)("li",null,(0,r.createElement)("strong",null,(0,n.__)("Get your application password","bubuku-media-library")),(0,r.createElement)("span",null,(0,n.__)("Go to","bubuku-media-library")," ",(0,r.createElement)("a",{href:l,target:"_blank",rel:"noopener noreferrer"},(0,n.__)("Profile -> Application Passwords","bubuku-media-library"))," ",(0,n.__)("and create one for your WordPress user.","bubuku-media-library"))),(0,r.createElement)("li",null,(0,r.createElement)("strong",null,(0,n.__)("Encode credentials","bubuku-media-library")),(0,r.createElement)("span",null,(0,n.__)("Base64-encode","bubuku-media-library")," ",(0,r.createElement)("code",null,"username:app_password")," ",(0,n.__)("and replace","bubuku-media-library")," ",(0,r.createElement)("code",null,"BASE64_OF_USER_AND_APP_PASSWORD"),".")),(0,r.createElement)("li",null,(0,r.createElement)("strong",null,(0,n.__)("Add to claude_desktop_config.json","bubuku-media-library")),(0,r.createElement)("span",null,(0,n.__)("Requires","bubuku-media-library")," ",(0,r.createElement)("a",{href:"https://nodejs.org/",target:"_blank",rel:"noopener noreferrer"},(0,n.__)("Node.js","bubuku-media-library"))," ",(0,n.__)("- Claude Desktop uses","bubuku-media-library")," ",(0,r.createElement)("code",null,"mcp-remote")," ",(0,n.__)("via","bubuku-media-library")," ",(0,r.createElement)("code",null,"npx")," ",(0,n.__)("as a stdio bridge.","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-mcp-code-block"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>d(m,"snippet")},"snippet"===u?(0,n.__)("Copied","bubuku-media-library"):(0,n.__)("Copy","bubuku-media-library")),(0,r.createElement)("pre",null,(0,r.createElement)("code",null,m))),(0,r.createElement)("div",{className:"bbk-email-hint bbk-mcp-info-box"},(0,r.createElement)("p",null,(0,n.__)("This URL will return a 401 error when opened in a browser — that's normal, as it requires authenticated credentials.","bubuku-media-library"))))),t&&(0,r.createElement)("p",{className:"bbk-agent-api-card__action"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary",onClick:()=>{"function"==typeof a&&a()}},(0,n.__)("Manage per-tool abilities","bubuku-media-library")))))},ce={tools:[],roles:{}},me=e=>e&&e.success&&e.data?{tools:Array.isArray(e.data.tools)?e.data.tools:[],roles:e.data.roles&&"object"==typeof e.data.roles?e.data.roles:{}}:ce,de=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"9 18 15 12 9 6"})),be=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"11",cy:"11",r:"8"}),(0,r.createElement)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),he=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),pe=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.createElement)("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})),_e=({onToolsLoaded:e=null})=>{const[t,a]=(0,i.useState)(!0),[l,o]=(0,i.useState)(!1),[u,c]=(0,i.useState)(""),[m,d]=(0,i.useState)(""),[b,h]=(0,i.useState)(ce),[p,_]=(0,i.useState)(null),[k,f]=(0,i.useState)(""),y=(0,i.useMemo)(()=>{if(!k.trim())return b.tools;const e=k.toLowerCase();return b.tools.filter(t=>(t.label||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)||(t.description||"").toLowerCase().includes(e))},[b.tools,k]),g=(0,i.useMemo)(()=>b.tools.filter(e=>e?.setting?.enabled).length,[b.tools]),E=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/get-tools-settings`,[]),v=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/set-tools-settings`,[]);(0,i.useEffect)(()=>{fetch(E,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(t=>{const r=me(t);h(r),a(!1),e&&e(r.tools.length)}).catch(()=>{c((0,n.__)("Could not load tools settings. Please refresh and try again.","bubuku-media-library")),a(!1)})},[E]);const w=e=>_(t=>t===e?null:e);return(0,r.createElement)("div",{className:"bbk-tools-abilities-panel"},(0,r.createElement)(ue,{animationDelay:".06s"}),(0,r.createElement)(s,{title:(0,n.__)("Per-tool permissions","bubuku-media-library"),claim:(0,n.__)("Enable each tool and define the minimum role required to execute it.","bubuku-media-library"),icon:(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M12 20h9"}),(0,r.createElement)("path",{d:"M12 4h9"}),(0,r.createElement)("path",{d:"M4 9h16"}),(0,r.createElement)("path",{d:"M4 15h16"}),(0,r.createElement)("path",{d:"M5 4v16"}))},t&&(0,r.createElement)("p",{className:"bbk-tools-placeholder"},(0,n.__)("Loading tools settings...","bubuku-media-library")),!t&&u&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--error"},u),!t&&m&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--success"},m),!t&&!u&&0===b.tools.length&&(0,r.createElement)("p",{className:"bbk-tools-placeholder"},(0,n.__)("No tools were discovered. Check your tools loader configuration.","bubuku-media-library")),!t&&b.tools.length>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"bbk-tools-toolbar"},(0,r.createElement)("div",{className:"bbk-tools-search-wrap"},(0,r.createElement)(be,null),(0,r.createElement)("input",{type:"search",className:"bbk-tools-search",placeholder:(0,n.__)("Search tools by name or slug...","bubuku-media-library"),value:k,onChange:e=>f(e.target.value)})),(0,r.createElement)("div",{className:"bbk-tools-toolbar-actions"},(0,r.createElement)("span",{className:"bbk-tools-enabled-count"},g," ",(0,n.__)("of","bubuku-media-library")," ",b.tools.length," ",(0,n.__)("enabled","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>{h(e=>({...e,tools:e.tools.map(e=>({...e,setting:{...e.setting,enabled:!0}}))}))}},(0,r.createElement)(he,null),(0,n.__)("Enable all","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>{h(e=>({...e,tools:e.tools.map(e=>({...e,setting:{...e.setting,enabled:!1}}))}))}},(0,r.createElement)(pe,null),(0,n.__)("Disable all","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-tools-table-wrap"},(0,r.createElement)("table",{className:"bbk-tools-table"},(0,r.createElement)("thead",null,(0,r.createElement)("tr",null,(0,r.createElement)("th",{className:"bbk-tools-col-expand"}),(0,r.createElement)("th",null,(0,n.__)("Tool","bubuku-media-library")),(0,r.createElement)("th",{className:"bbk-tools-col-help"},(0,n.__)("Help","bubuku-media-library")),(0,r.createElement)("th",{className:"bbk-tools-col-role"},(0,n.__)("Minimum role","bubuku-media-library")),(0,r.createElement)("th",{className:"bbk-tools-col-enabled"},(0,n.__)("Enabled","bubuku-media-library")))),(0,r.createElement)("tbody",null,0===y.length?(0,r.createElement)("tr",null,(0,r.createElement)("td",{colSpan:5,className:"bbk-tools-no-results"},(0,n.__)("No tools match your search.","bubuku-media-library"))):null,y.map(e=>{const t=Boolean(e?.setting?.enabled),a=p===e.name,i=e?.setting?.role||"editor",l=`tool-${String(e.name).replace(/[^a-zA-Z0-9_-]/g,"-")}`,s=e.help?.criteria||e.help?.examples?.length>0;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("tr",{key:e.name,className:t?"":"is-disabled"},(0,r.createElement)("td",{className:"bbk-tools-col-expand"},s&&(0,r.createElement)("button",{type:"button",className:"bbk-tools-expand-btn"+(a?" is-open":""),onClick:()=>w(e.name),"aria-label":a?(0,n.__)("Collapse","bubuku-media-library"):(0,n.__)("Expand","bubuku-media-library"),"aria-expanded":a},(0,r.createElement)(de,null))),(0,r.createElement)("td",null,(0,r.createElement)("strong",null,e.label),e.description&&(0,r.createElement)("p",{className:"bbk-tools-info-desc"},e.description)),(0,r.createElement)("td",{className:"bbk-tools-col-help"},s&&(0,r.createElement)("button",{type:"button",className:"bbk-tools-help-btn"+(a?" is-active":""),onClick:()=>w(e.name),"aria-label":(0,n.__)("Help","bubuku-media-library")},"?")),(0,r.createElement)("td",{className:"bbk-tools-col-role"},(0,r.createElement)("select",{value:i,onChange:t=>{return a=e.name,r=t.target.value,void h(e=>({...e,tools:e.tools.map(e=>e.name===a?{...e,setting:{...e.setting,role:r}}:e)}));var a,r}},Object.entries(b.roles).map(([e,t])=>(0,r.createElement)("option",{key:e,value:e},t))),!1===e.meets_capability_floor&&(0,r.createElement)("p",{className:"bbk-tools-role-warning",title:(0,n.__)("This tool always requires a minimum WordPress capability at runtime, regardless of the role selected here. The saved role is not being changed automatically.","bubuku-media-library")},(0,n.__)("⚠ Below this tool's required capability — it will still enforce it.","bubuku-media-library"))),(0,r.createElement)("td",{className:"bbk-tools-col-enabled"},(0,r.createElement)("label",{className:"bbk-tools-toggle",htmlFor:l},(0,r.createElement)("input",{id:l,type:"checkbox",checked:t,onChange:t=>{return a=e.name,r=t.target.checked,void h(e=>({...e,tools:e.tools.map(e=>e.name===a?{...e,setting:{...e.setting,enabled:r}}:e)}));var a,r}})))),a&&(0,r.createElement)("tr",{key:`${e.name}-info`,className:"bbk-tools-info-row"},(0,r.createElement)("td",{colSpan:"5"},(0,r.createElement)("div",{className:"bbk-tools-info-panel"},(e.help?.criteria||e.help?.examples?.length>0)&&(0,r.createElement)("div",{className:"bbk-tools-info-layout"},e.help?.criteria&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"bbk-tools-info-label"},(0,n.__)("When to use","bubuku-media-library")),(0,r.createElement)("p",{className:"bbk-tools-info-criteria"},e.help.criteria)),e.help?.examples?.length>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"bbk-tools-info-label"},(0,n.__)("Example prompts","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-tools-examples-list"},e.help.examples.map((t,a)=>(0,r.createElement)("div",{key:`${e.name}-ex-${a}`,className:"bbk-tools-example"},t)))))))))}))))),!t&&b.tools.length>0&&(0,r.createElement)("div",{className:"bbk-tools-actions"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-primary",onClick:()=>{o(!0),c(""),d("");const e=b.tools.reduce((e,t)=>(e[t.name]={enabled:t.setting?.enabled?1:0,role:t.setting?.role||"editor"},e),{});fetch(v,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":BbkMediaLibrary.rest_nonce},body:JSON.stringify({settings:e})}).then(e=>e.json()).then(e=>{o(!1),e&&e.success?(h(me(e)),d(e?.data?.message||(0,n.__)("Tools settings saved.","bubuku-media-library"))):c((0,n.__)("Could not save tools settings. Please try again.","bubuku-media-library"))}).catch(()=>{o(!1),c((0,n.__)("A network error occurred while saving. Please try again.","bubuku-media-library"))})},disabled:l},l?(0,n.__)("Saving...","bubuku-media-library"):(0,n.__)("Save tools settings","bubuku-media-library")))))},ke="overview",fe="export-import",ye="settings",ge="tools-abilities",Ee=ke,ve=[{id:ke,label:(0,n.__)("Overview","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))},{id:fe,label:(0,n.__)("Export/Import","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5M16.5 3 21 7.5m0 0L16.5 12M21 7.5H7.5"}))},{id:ye,label:(0,n.__)("Settings","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 0 1 0 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.216.456a1.125 1.125 0 0 1-1.37-.49l-1.296-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 0 1 0-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.369-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281Z"}),(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))},{id:ge,label:(0,n.__)("Tools & Abilities","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","aria-hidden":"true"},(0,r.createElement)("path",{d:"M12 8V4H8"}),(0,r.createElement)("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),(0,r.createElement)("path",{d:"M2 14h2"}),(0,r.createElement)("path",{d:"M20 14h2"}),(0,r.createElement)("path",{d:"M15 13v2"}),(0,r.createElement)("path",{d:"M9 13v2"}))}],we=()=>{const e=new URLSearchParams(window.location.search).get("tab");return ve.some(t=>t.id===e)?e:Ee},Ne=function(){const[e,t]=(0,i.useState)(()=>we()),[a,s]=(0,i.useState)(0);(0,i.useEffect)(()=>{const e=()=>{t(we())};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)}},[]);return(0,r.createElement)("div",{className:"bk-app"},(0,r.createElement)(l,null),(0,r.createElement)("div",{className:"bbk-admin-tabs",role:"tablist","aria-label":(0,n.__)("Bubuku Settings","bubuku-media-library")},ve.map(({id:i,label:n,icon:l})=>(0,r.createElement)("button",{key:i,type:"button",role:"tab","aria-selected":e===i,className:"bbk-admin-tab "+(e===i?"is-active":""),onClick:()=>{return t(e=i),void(e=>{const t=new URL(window.location.href);e===Ee?t.searchParams.delete("tab"):t.searchParams.set("tab",e),window.history.replaceState({},"",`${t.pathname}${t.search}`)})(e);var e}},(0,r.createElement)(l,null),n,i===ge&&a>0&&(0,r.createElement)("span",{className:"bbk-admin-tab__badge"},a)))),(0,r.createElement)("div",{role:"tabpanel"},e===ke&&(0,r.createElement)(v,null),e===fe&&(0,r.createElement)(q,null),e===ye&&(0,r.createElement)(Q,null),e===ge&&(0,r.createElement)(_e,{onToolsLoaded:s})),(0,r.createElement)(se,null))};document.addEventListener("DOMContentLoaded",function(){const e=document.getElementById("bbk-media-library-app");null!=e&&(0,i.createRoot)(e).render((0,r.createElement)(Ne,null))})},901(){},809(e,t){var a,r;a=function e(){var t,a="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==a?a:{},r=!a.document&&!!a.postMessage,i=a.IS_PAPA_WORKER||!1,n={},l=0,s={};function o(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=y(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new b(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,t){var r=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<r){let t=this._config.newline;t||(n=this._config.quoteChar||'"',t=this._handle.guessLineEndings(e,n)),e=[...e.split(t).slice(r)].join(t)}this.isFirstChunk&&E(this._config.beforeFirstChunk)&&void 0!==(n=this._config.beforeFirstChunk(e))&&(e=n),this.isFirstChunk=!1,this._halted=!1,r=this._partialLine+e;var n=(this._partialLine="",this._handle.parse(r,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(e=n.meta.cursor,this._finished||(this._partialLine=r.substring(e-this._baseIndex),this._baseIndex=e),n&&n.data&&(this._rowCount+=n.data.length),r=this._finished||this._config.preview&&this._rowCount>=this._config.preview,i)a.postMessage({results:n,workerId:s.WORKER_ID,finished:r});else if(E(this._config.chunk)&&!t){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=n=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!r||!E(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),r||n&&n.meta.paused||this._nextChunk(),n}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):i&&this._config.error&&a.postMessage({workerId:s.WORKER_ID,error:e,finished:!1})}}function u(e){var t;(e=e||{}).chunkSize||(e.chunkSize=s.RemoteChunkSize),o.call(this,e),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),r||(t.onload=g(this._chunkLoaded,this),t.onerror=g(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var e,a=this._config.downloadRequestHeaders;for(e in a)t.setRequestHeader(e,a[e])}var i;this._config.chunkSize&&(i=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+i));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}r&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(e=>null!==(e=e.getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1)(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(new Error(e))}}function c(e){(e=e||{}).chunkSize||(e.chunkSize=s.LocalChunkSize),o.call(this,e);var t,a,r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,a=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=g(this._chunkLoaded,this),t.onerror=g(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input,i=(this._config.chunkSize&&(i=Math.min(this._start+this._config.chunkSize,this._input.size),e=a.call(e,this._start,i)),t.readAsText(e,this._config.encoding));r||this._chunkLoaded({target:{result:i}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function m(e){var t;o.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,a;if(!this._finished)return e=this._config.chunkSize,t=e?(a=t.substring(0,e),t.substring(e)):(a=t,""),this._finished=!t,this.parseChunk(a)}}function d(e){o.call(this,e=e||{});var t=[],a=!0,r=!1;this.pause=function(){o.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){o.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):a=!0},this._streamData=g(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),a&&(a=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=g(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=g(function(){this._streamCleanUp(),r=!0,this._streamData("")},this),this._streamCleanUp=g(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function b(e){var t,a,r,i,n=Math.pow(2,53),l=-n,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,u=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,c=this,m=0,d=0,b=!1,_=!1,k=[],f={data:[],errors:[],meta:{}};function g(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function v(){if(f&&r&&(N("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(f.data=f.data.filter(function(e){return!g(e)})),w()){if(f)if(Array.isArray(f.data[0])){for(var t=0;w()&&t<f.data.length;t++)f.data[t].forEach(a);f.data.splice(0,1)}else f.data.forEach(a);function a(t,a){E(e.transformHeader)&&(t=e.transformHeader(t,a)),k.push(t)}}function i(t,a){for(var r=e.header?{}:[],i=0;i<t.length;i++){var s=i,c=t[i];c=((t,a)=>(t=>(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping)))(t)?"true"===a||"TRUE"===a||"false"!==a&&"FALSE"!==a&&((e=>{if(o.test(e)&&(e=parseFloat(e),l<e&&e<n))return 1})(a)?parseFloat(a):u.test(a)?new Date(a):""===a?null:a):a)(s=e.header?i>=k.length?"__parsed_extra":k[i]:s,c=e.transform?e.transform(c,s):c),"__parsed_extra"===s?(r[s]=r[s]||[],r[s].push(c)):r[s]=c}return e.header&&(i>k.length?N("FieldMismatch","TooManyFields","Too many fields: expected "+k.length+" fields but parsed "+i,d+a):i<k.length&&N("FieldMismatch","TooFewFields","Too few fields: expected "+k.length+" fields but parsed "+i,d+a)),r}var c;f&&(e.header||e.dynamicTyping||e.transform)&&(c=1,!f.data.length||Array.isArray(f.data[0])?(f.data=f.data.map(i),c=f.data.length):f.data=i(f.data,0),e.header&&f.meta&&(f.meta.fields=k),d+=c)}function w(){return e.header&&0===k.length}function N(e,t,a,r){e={type:e,code:t,message:a},void 0!==r&&(e.row=r),f.errors.push(e)}E(e.step)&&(i=e.step,e.step=function(t){f=t,w()?v():(v(),0!==f.data.length&&(m+=t.data.length,e.preview&&m>e.preview?a.abort():(f.data=f.data[0],i(f,c))))}),this.parse=function(i,n,l){var o=e.quoteChar||'"';return e.newline||(e.newline=this.guessLineEndings(i,o)),r=!1,e.delimiter?E(e.delimiter)&&(e.delimiter=e.delimiter(i),f.meta.delimiter=e.delimiter):((o=((t,a,r,i,n)=>{var l,o,u,c;n=n||[",","\t","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var m=0;m<n.length;m++){for(var d,b=n[m],h=0,_=0,k=0,f=(u=void 0,new p({comments:i,delimiter:b,newline:a,preview:10}).parse(t)),y=0;y<f.data.length;y++)r&&g(f.data[y])?k++:(_+=d=f.data[y].length,void 0===u?u=d:0<d&&(h+=Math.abs(d-u),u=d));0<f.data.length&&(_/=f.data.length-k),(void 0===o||h<=o)&&(void 0===c||c<_)&&1.99<_&&(o=h,l=b,c=_)}return{successful:!!(e.delimiter=l),bestDelimiter:l}})(i,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess)).successful?e.delimiter=o.bestDelimiter:(r=!0,e.delimiter=s.DefaultDelimiter),f.meta.delimiter=e.delimiter),o=y(e),e.preview&&e.header&&o.preview++,t=i,a=new p(o),f=a.parse(t,n,l),v(),b?{meta:{paused:!0}}:f||{meta:{paused:!1}}},this.paused=function(){return b},this.pause=function(){b=!0,a.abort(),t=E(e.chunk)?"":t.substring(a.getCharIndex())},this.resume=function(){c.streamer._halted?(b=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return _},this.abort=function(){_=!0,a.abort(),f.meta.aborted=!0,E(e.complete)&&e.complete(f),t=""},this.guessLineEndings=function(e,t){e=e.substring(0,1048576),t=new RegExp(h(t)+"([^]*?)"+h(t),"gm");var a=(e=e.replace(t,"")).split("\r");if(e=1<(t=e.split("\n")).length&&t[0].length<a[0].length,1===a.length||e)return"\n";for(var r=0,i=0;i<a.length;i++)"\n"===a[i][0]&&r++;return r>=a.length/2?"\r\n":"\r"}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function p(e){var t=(e=e||{}).delimiter,a=e.newline,r=e.comments,i=e.step,n=e.preview,l=e.fastMode,o=null,u=!1,c=null==e.quoteChar?'"':e.quoteChar,m=c;if(void 0!==e.escapeChar&&(m=e.escapeChar),("string"!=typeof t||-1<s.BAD_DELIMITERS.indexOf(t))&&(t=","),r===t)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<s.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==a&&"\r"!==a&&"\r\n"!==a&&(a="\n");var d=0,b=!1;this.parse=function(s,p,_){if("string"!=typeof s)throw new Error("Input must be a string");var k=s.length,f=t.length,y=a.length,g=r.length,v=E(i),w=[],N=[],x=[],C=d=0;if(!s)return B();if(l||!1!==l&&-1===s.indexOf(c)){for(var S=s.split(a),L=0;L<S.length;L++){if(x=S[L],d+=x.length,L!==S.length-1)d+=a.length;else if(_)return B();if(!r||x.substring(0,g)!==r){if(v){if(w=[],A(x.split(t)),j(),b)return B()}else A(x.split(t));if(n&&n<=L)return w=w.slice(0,n),B(!0)}}return B()}for(var M=s.indexOf(t,d),T=s.indexOf(a,d),D=new RegExp(h(m)+h(c),"g"),R=s.indexOf(c,d);;)if(s[d]===c)for(R=d,d++;;){if(-1===(R=s.indexOf(c,R+1)))return _||N.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:w.length,index:d}),I();if(R===k-1)return I(s.substring(d,R).replace(D,c));if(c===m&&s[R+1]===m)R++;else if(c===m||0===R||s[R-1]!==m){-1!==M&&M<R+1&&(M=s.indexOf(t,R+1));var z=O(-1===(T=-1!==T&&T<R+1?s.indexOf(a,R+1):T)?M:Math.min(M,T));if(s.substr(R+1+z,f)===t){x.push(s.substring(d,R).replace(D,c)),s[d=R+1+z+f]!==c&&(R=s.indexOf(c,d)),M=s.indexOf(t,d),T=s.indexOf(a,d);break}if(z=O(T),s.substring(R+1+z,R+1+z+y)===a){if(x.push(s.substring(d,R).replace(D,c)),P(R+1+z+y),M=s.indexOf(t,d),R=s.indexOf(c,d),v&&(j(),b))return B();if(n&&w.length>=n)return B(!0);break}N.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:d}),R++}}else if(r&&0===x.length&&s.substring(d,d+g)===r){if(-1===T)return B();d=T+y,T=s.indexOf(a,d),M=s.indexOf(t,d)}else if(-1!==M&&(M<T||-1===T))x.push(s.substring(d,M)),d=M+f,M=s.indexOf(t,d);else{if(-1===T)break;if(x.push(s.substring(d,T)),P(T+y),v&&(j(),b))return B();if(n&&w.length>=n)return B(!0)}return I();function A(e){w.push(e),C=d}function O(e){return-1!==e&&(e=s.substring(R+1,e))&&""===e.trim()?e.length:0}function I(e){return _||(void 0===e&&(e=s.substring(d)),x.push(e),d=k,A(x),v&&j()),B()}function P(e){d=e,A(x),x=[],T=s.indexOf(a,d)}function B(r){if(e.header&&!p&&w.length&&!u){var i=w[0],n=Object.create(null),l=new Set(i);let t=!1;for(let a=0;a<i.length;a++){let r=i[a];if(n[r=E(e.transformHeader)?e.transformHeader(r,a):r]){let e,s=n[r];for(;e=r+"_"+s,s++,l.has(e););l.add(e),i[a]=e,n[r]++,t=!0,(o=null===o?{}:o)[e]=r}else n[r]=1,i[a]=r;l.add(r)}t&&console.warn("Duplicate headers found and renamed."),u=!0}return{data:w,errors:N,meta:{delimiter:t,linebreak:a,aborted:b,truncated:!!r,cursor:C+(p||0),renamedHeaders:o}}}function j(){i(B()),w=[],N=[]}},this.abort=function(){b=!0},this.getCharIndex=function(){return d}}function _(e){var t=e.data,a=n[t.workerId],r=!1;if(t.error)a.userError(t.error,t.file);else if(t.results&&t.results.data){var i={abort:function(){r=!0,k(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:f,resume:f};if(E(a.userStep)){for(var l=0;l<t.results.data.length&&(a.userStep({data:t.results.data[l],errors:t.results.errors,meta:t.results.meta},i),!r);l++);delete t.results}else E(a.userChunk)&&(a.userChunk(t.results,i,t.file),delete t.results)}t.finished&&!r&&k(t.workerId,t.results)}function k(e,t){var a=n[e];E(a.userComplete)&&a.userComplete(t),a.terminate(),delete n[e]}function f(){throw new Error("Not implemented.")}function y(e){if("object"!=typeof e||null===e)return e;var t,a=Array.isArray(e)?[]:{};for(t in e)a[t]=y(e[t]);return a}function g(e,t){return function(){e.apply(t,arguments)}}function E(e){return"function"==typeof e}return s.parse=function(t,r){var i=(r=r||{}).dynamicTyping||!1;if(E(i)&&(r.dynamicTypingFunction=i,i={}),r.dynamicTyping=i,r.transform=!!E(r.transform)&&r.transform,!r.worker||!s.WORKERS_SUPPORTED)return i=null,s.NODE_STREAM_INPUT,"string"==typeof t?(t=(e=>65279!==e.charCodeAt(0)?e:e.slice(1))(t),i=new(r.download?u:m)(r)):!0===t.readable&&E(t.read)&&E(t.on)?i=new d(r):(a.File&&t instanceof File||t instanceof Object)&&(i=new c(r)),i.stream(t);(i=(()=>{var t;return!!s.WORKERS_SUPPORTED&&(t=(()=>{var t=a.URL||a.webkitURL||null,r=e.toString();return s.BLOB_URL||(s.BLOB_URL=t.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",r,")();"],{type:"text/javascript"})))})(),(t=new a.Worker(t)).onmessage=_,t.id=l++,n[t.id]=t)})()).userStep=r.step,i.userChunk=r.chunk,i.userComplete=r.complete,i.userError=r.error,r.step=E(r.step),r.chunk=E(r.chunk),r.complete=E(r.complete),r.error=E(r.error),delete r.worker,i.postMessage({input:t,config:r,workerId:i.id})},s.unparse=function(e,t){var a=!1,r=!0,i=",",n="\r\n",l='"',o=l+l,u=!1,c=null,m=!1,d=((()=>{if("object"==typeof t){if("string"!=typeof t.delimiter||s.BAD_DELIMITERS.filter(function(e){return-1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),"boolean"!=typeof t.quotes&&"function"!=typeof t.quotes&&!Array.isArray(t.quotes)||(a=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(u=t.skipEmptyLines),"string"==typeof t.newline&&(n=t.newline),"string"==typeof t.quoteChar&&(l=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(o=t.escapeChar+l),t.escapeFormulae instanceof RegExp?m=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(m=/^[=+\-@\t\r].*$/)}})(),new RegExp(h(l),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return b(null,e,u);if("object"==typeof e[0])return b(c||Object.keys(e[0]),e,u)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||c),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),b(e.fields||[],e.data||[],u);throw new Error("Unable to serialize unrecognized input");function b(e,t,a){var l="",s=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0<e.length),o=!Array.isArray(t[0]);if(s&&r){for(var u=0;u<e.length;u++)0<u&&(l+=i),l+=p(e[u],u);0<t.length&&(l+=n)}for(var c=0;c<t.length;c++){var m=(s?e:t[c]).length,d=!1,b=s?0===Object.keys(t[c]).length:0===t[c].length;if(a&&!s&&(d="greedy"===a?""===t[c].join("").trim():1===t[c].length&&0===t[c][0].length),"greedy"===a&&s){for(var h=[],_=0;_<m;_++){var k=o?e[_]:_;h.push(t[c][k])}d=""===h.join("").trim()}if(!d){for(var f=0;f<m;f++){0<f&&!b&&(l+=i);var y=s&&o?e[f]:f;l+=p(t[c][y],f)}c<t.length-1&&(!a||0<m&&!b)&&(l+=n)}}return l}function p(e,t){var r,n;return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(n=!1,m&&"string"==typeof e&&m.test(e)&&(e="'"+e,n=!0),r=e.toString().replace(d,o),(n=n||!0===a||"function"==typeof a&&a(e,t)||Array.isArray(a)&&a[t]||((e,t)=>{for(var a=0;a<t.length;a++)if(-1<e.indexOf(t[a]))return!0;return!1})(r,s.BAD_DELIMITERS)||-1<r.indexOf(i)||" "===r.charAt(0)||" "===r.charAt(r.length-1))?l+r+l:r)}},s.RECORD_SEP=String.fromCharCode(30),s.UNIT_SEP=String.fromCharCode(31),s.BYTE_ORDER_MARK="\ufeff",s.BAD_DELIMITERS=["\r","\n",'"',s.BYTE_ORDER_MARK],s.WORKERS_SUPPORTED=!r&&!!a.Worker,s.NODE_STREAM_INPUT=1,s.LocalChunkSize=10485760,s.RemoteChunkSize=5242880,s.DefaultDelimiter=",",s.Parser=p,s.ParserHandle=b,s.NetworkStreamer=u,s.FileStreamer=c,s.StringStreamer=m,s.ReadableStreamStreamer=d,a.jQuery&&((t=a.jQuery).fn.parse=function(e){var r=e.config||{},i=[];return this.each(function(e){if("INPUT"!==t(this).prop("tagName").toUpperCase()||"file"!==t(this).attr("type").toLowerCase()||!a.FileReader||!this.files||0===this.files.length)return!0;for(var n=0;n<this.files.length;n++)i.push({file:this.files[n],inputElem:this,instanceConfig:t.extend({},r)})}),n(),this;function n(){if(0===i.length)E(e.complete)&&e.complete();else{var a,r,n,o=i[0];if(E(e.before)){var u=e.before(o.file,o.inputElem);if("object"==typeof u){if("abort"===u.action)return a=o.file,r=o.inputElem,n=u.reason,void(E(e.error)&&e.error({name:"AbortError"},a,r,n));if("skip"===u.action)return void l();"object"==typeof u.config&&(o.instanceConfig=t.extend(o.instanceConfig,u.config))}else if("skip"===u)return void l()}var c=o.instanceConfig.complete;o.instanceConfig.complete=function(e){E(c)&&c(e,o.file,o.inputElem),l()},s.parse(o.file,o.instanceConfig)}}function l(){i.splice(0,1),n()}}),i&&(a.onmessage=function(e){e=e.data,void 0===s.WORKER_ID&&e&&(s.WORKER_ID=e.workerId),"string"==typeof e.input?a.postMessage({workerId:s.WORKER_ID,results:s.parse(e.input,e.config),finished:!0}):(a.File&&e.input instanceof File||e.input instanceof Object)&&(e=s.parse(e.input,e.config))&&a.postMessage({workerId:s.WORKER_ID,results:e,finished:!0})}),(u.prototype=Object.create(o.prototype)).constructor=u,(c.prototype=Object.create(o.prototype)).constructor=c,(m.prototype=Object.create(m.prototype)).constructor=m,(d.prototype=Object.create(o.prototype)).constructor=d,s},void 0===(r=a.apply(t,[]))||(e.exports=r)}},a={};function r(e){var i=a[e];if(void 0!==i)return i.exports;var n=a[e]={exports:{}};return t[e].call(n.exports,n,n.exports,r),n.exports}r.m=t,e=[],r.O=(t,a,i,n)=>{if(!a){var l=1/0;for(c=0;c<e.length;c++){for(var[a,i,n]=e[c],s=!0,o=0;o<a.length;o++)(!1&n||l>=n)&&Object.keys(r.O).every(e=>r.O[e](a[o]))?a.splice(o--,1):(s=!1,n<l&&(l=n));if(s){e.splice(c--,1);var u=i();void 0!==u&&(t=u)}}return t}n=n||0;for(var c=e.length;c>0&&e[c-1][2]>n;c--)e[c]=e[c-1];e[c]=[a,i,n]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={884:0,15:0};r.O.j=t=>0===e[t];var t=(t,a)=>{var i,n,[l,s,o]=a,u=0;if(l.some(t=>0!==e[t])){for(i in s)r.o(s,i)&&(r.m[i]=s[i]);if(o)var c=o(r)}for(t&&t(a);u<l.length;u++)n=l[u],r.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return r.O(c)},a=globalThis.webpackChunkbubuku_media_library=globalThis.webpackChunkbubuku_media_library||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})(),r.O(void 0,[15],()=>r(651));var i=r.O(void 0,[15],()=>r(901));i=r.O(i)})(); -
bubuku-media-library/tags/1.4.3/assets/build/style-admin.css
r3741020 r3751624 1 #bbk-media-library-app{--primary:#239295;--primary-dark:#1f8288;--accent:#ffc629;--accent-dark:#e8a100;--text:#132633;--text-light:#22394a;--text-muted:#54707e;--border:#dce7f0;--border-strong:#c3d4e0;--background:#eff4f8;--surface:#fff;--bg-cool:#e7f3f3;--green-500:#1f9d6b;--green-600:#177a52;--red-500:#d1503c;--green-100:#ecfdf5;--green-300:#a7d9c4;--green-700:#065f46;--red-100:#fef2f2;--red-300:#f3b4ab;--red-700:#7f1d1d;--amber-100:#fff3ce;--amber-700:#92400e;--shadow-pluma:0 1px 2px rgba(19,38,51,.06),0 2px 8px rgba(19,38,51,.05);--shadow-profunda:0 4px 12px rgba(19,38,51,.08),0 32px 64px -16px rgba(31,130,136,.22);--shadow-panel:0 0 0 1px rgba(19,38,51,.06),0 16px 48px -12px rgba(19,38,51,.18);--radius-button:8px;--radius-medium:10px;--radius-large:16px;--focus-ring:0 0 0 3px rgba(35,146,149,.2);--transition-fast:150ms cubic-bezier(0.3,0,0.2,1);--transition-base:280ms cubic-bezier(0.3,0,0.2,1);--code-bg:#eaf0f5;--brand:var(--primary);--brand-hover:var(--primary-dark);--brand-soft:var(--bg-cool);--cta:var(--accent);--cta-hover:var(--accent-dark);--cta-ink:var(--text);--bg-page:var(--background);--surface-card:var(--surface);--surface-sunken:var(--background);--text-heading:var(--text);--text-body:var(--text-light);--text-invert:var(--surface);--border-card:var(--border)}@keyframes bk-fadeDown{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes bk-fadeUp{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes bk-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.bk-btn{align-items:center;border:none;border-radius:var(--radius-button);cursor:pointer;display:flex;font-size:.9;font-weight:500;gap:7px;padding:13px 18px;text-decoration:none;transition:all .15s;white-space:nowrap}.bk-btn:active{transform:translateY(0)}.bk-btn:disabled{cursor:not-allowed;opacity:.6;pointer-events:none}.bk-btn.bk-btn-primary{background:var(--brand);box-shadow:0 2px 8px rgba(35,146,149,.25);color:var(--text-invert)}.bk-btn.bk-btn-primary:hover{background:var(--brand-hover);box-shadow:0 4px 12px rgba(35,146,149,.35);transform:translateY(-1px)}.bk-btn.bk-btn-secondary{background:transparent;border:1px solid rgba(35,146,149,.35);color:var(--brand)}.bk-btn.bk-btn-secondary:hover{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-hover)}.bk-btn.bk-btn-success{background:var(--green-500);box-shadow:0 2px 8px rgba(31,157,107,.25);color:var(--text-invert)}.bk-btn.bk-btn-success:hover{background:var(--green-600);box-shadow:0 4px 12px rgba(31,157,107,.35);transform:translateY(-1px)}.bbk-notice{align-items:center;border-radius:var(--radius-button);display:flex;font-size:.85rem;gap:10px;margin:0;padding:10px 14px}.bbk-notice svg{flex-shrink:0}.bbk-notice--green-500{background:var(--green-100);border:1.5px solid var(--green-300);color:var(--green-700)}.bbk-notice--error{background:var(--red-100);border:1.5px solid var(--red-300);color:var(--red-700)}.b k-app{margin:0 auto;max-width:1180px}.bbk-admin-tabs{border-bottom:1px solid var(--border-card);display:flex;flex-wrap:wrap;margin:0 0 24px}.bbk-admin-tab{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:none;border-bottom:4px solid transparent;border-top-left-radius:6px;border-top-right-radius:6px;color:var(--text-muted);cursor:pointer;display:inline-flex;font-size:13px;font-weight:500;gap:6px;margin-bottom:-1px;padding:10px 16px;transition:color .15s ease,border-color .15s ease,background .15s ease}.bbk-admin-tab svg{flex-shrink:0;height:20px;width:20px}.bbk-admin-tab.is-active,.bbk-admin-tab:hover{color:var(--text-heading)}.bbk-admin-tab.is-active{background:var(--surface-card);border-bottom-color:var(--cta);font-weight:600}.bbk-admin-tab.is-active .bbk-admin-tab__badge{background:var(--cta);color:var(--cta-ink);opacity:1;transition:background .15s ease,opacity .15s ease}.bbk-admin-tab__badge{align-items:center;background:var(--text-muted);border-radius:9px;color:var(--text-invert);display:inline-flex;font-size:11px;font-weight:700;height:18px;justify-content:center;line-height:1;min-width:18px;opacity:.4;padding:0 5px}.bk-header-main{align-items:center;animation:bk-fadeDown .5s ease both;display:flex;gap:16px;margin-bottom:36px}.bk-header-main .bk-icon{align-items:center;background:var(--brand);border-radius:var(--radius-button);box-shadow:0 4px 12px rgba(35,146,149,.3);display:flex;flex-shrink:0;height:48px;justify-content:center;width:48px}.bk-header-main .bk-icon svg{color:var(--text-invert)}.bk-header-main .bk-title{color:var(--text-heading);font-size:22px;font-weight:600;letter-spacing:-.3px;margin:0;padding:0}.bk-header-main .bk-title span{color:var(--brand)}.bk-header-main .bk-subtitle{color:var(--text-muted);font-size:13.5px;margin:0}.bk-dashboard-card{animation:bk-fadeUp .5s ease both;background:var(--surface-card);border:1px solid var(--border-card);border-radius:var(--radius-large);box-shadow:var(--shadow-pluma);margin-bottom:16px;overflow:hidden;padding:0}.bk-dashboard-card .card-header{align-items:flex-start;border-bottom:1px solid var(--border-card);display:flex;gap:12px;justify-content:space-between;padding:20px 24px}.bk-dashboard-card .card-header-main{align-items:center;display:flex;gap:12px;min-width:0}.bk-dashboard-card .card-header-meta{flex-shrink:0}.bk-dashboard-card .card-header-icon{align-items:center;border-radius:8px;display:flex;flex-shrink:0;height:36px;justify-content:center;width:36px}.bk-dashboard-card .card-header-icon.icon-accent{background:var(--brand-soft);color:var(--brand)}.bk-dashboard-card .card-header-icon.icon-success{background:var(--green-100);color:var(--green-500)}.bk-dashboard-card .card-header-icon.icon-warning{background:var(--amber-100);color:var(--amber-700)}.bk-dashboard-card .card-header-text h2{color:var(--text-heading);font-size:14.5px;font-weight:600;letter-spacing:-.1px;margin:0}.bk-dashboard-card .card-header-text p{color:var(--text-muted);font-size:12.5px;margin-bottom:0;margin-top:1px}.bk-dashboard-card .card-body{padding:24px}.bk-card-footer{display:flex;flex-direction:column;gap:12px;margin-top:16px}.bk-card-footer .bk-btn{justify-content:center;width:100%}@media screen and (min-width:600px){.bk-card-footer{align-items:flex-end;flex-direction:row}.bk-card-footer .bk-card-footer__info{flex:1;min-width:0}.bk-card-footer .bk-btn{flex-shrink:0;margin-left:auto;width:25%}}.bk-card-footer__info{display:flex;flex-direction:column;gap:8px;min-width:0}.bbk-summary-grid{display:grid;gap:16px;grid-template-columns:1fr;margin-bottom:16px}@media screen and (min-width:960px){.bbk-summary-grid{grid-template-columns:1fr 1fr}}.bbk-size-summary{display:flex;flex-direction:column;gap:14px}.bbk-size-tiles{display:grid;gap:10px;grid-template-columns:repeat(3,1fr)}.bbk-size-tile{align-items:center;border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;flex-direction:column;padding:10px 8px;text-align:center}.bbk-size-tile__number{font-size:22px;font-weight:700;line-height:1.1}.bbk-size-tile__label{color:var(--text-muted);font-size:11px;line-height:1.3;margin-top:4px;text-transform:uppercase}.bbk-size-tile--good{background:var(--green-100);border-color:var(--green-500)}.bbk-size-tile--good .bbk-size-tile__number{color:var(--green-500)}.bbk-size-tile--medium{background:var(--amber-100);border-color:var(--amber-700)}.bbk-size-tile--medium .bbk-size-tile__number{color:var(--amber-700)}.bbk-size-tile--bad{background:var(--red-100);border-color:var(--red-500)}.bbk-size-tile--bad .bbk-size-tile__number{color:var(--red-500)}.bbk-size-bar__track{background:var(--border-card);border-radius:6px;display:flex;height:6px;overflow:hidden}.bbk-size-bar__segment{height:100%;transition:flex .4s ease}.bbk-size-bar__segment--good{background:var(--green-500)}.bbk-size-bar__segment--medium{background:var(--amber-700)}.bbk-size-bar__segment--bad{background:var(--red-500)}.bbk-size-bar__footer{display:flex;justify-content:space-between;margin-top:6px}.bbk-size-bar__total{color:var(--text-muted);font-size:11px}.bbk-size-bar__total strong{color:var(--text-heading)}.bbk-size-bar__attention{color:var(--red-500);font-size:11px;font-weight:500}.bbk-summary-alt-chart{align-items:center;display:flex;gap:24px;padding:8px 0}.bbk-summary-alt-chart__donut{flex-shrink:0}.bbk-summary-alt-chart__donut circle{transition:stroke-dashoffset .5s ease}.bbk-summary-alt-chart__legend{display:flex;flex-direction:column;gap:8px}.bbk-summary-alt-chart__legend-item{align-items:center;color:var(--text-heading);display:flex;font-size:13px;gap:8px}.bbk-summary-alt-chart__legend-dot{border-radius:50%;flex-shrink:0;height:10px;width:10px}.bbk-summary-alt-chart__legend-dot--missing{background:var(--red-500)}.bbk-summary-alt-chart__legend-dot--present{background:var(--green-500)}.bbk-summary-alt-chart__legend-value{font-weight:700;margin-left:auto;padding-left:16px}.bbk-summary-note{color:var(--text-muted);font-size:12px;margin-top:16px;text-align:center}.bbk-summary-skeleton{display:flex;flex-direction:column;gap:10px;padding:4px 0}.bbk-summary-skeleton__line{animation:bk-skeleton-shimmer 1.4s infinite;background:linear-gradient(90deg,var(--border-card) 25%,var(--surface-card) 50%,var(--border-card) 75%);background-size:200% 100%;border-radius:4px;height:14px}.bbk-summary-skeleton__line--short{width:40%}.bbk-summary-skeleton__line--medium{width:65%}.bbk-summary-skeleton__line--full{width:100%}.bbk-email-notifications{display:flex;flex-direction:column;gap:0}.bbk-email-notifications .form-row{display:flex;flex-direction:column;gap:10px;padding:16px 0}.bbk-email-notifications .form-row:first-of-type{padding-top:0}.bbk-email-notifications .form-row--separated{border-top:1px solid var(--border-card);padding-bottom:0}.bbk-email-notifications .form-row__label{display:flex;flex-direction:column;gap:2px}.bbk-email-notifications .form-row__title{color:var(--text-heading);font-size:13.5px;font-weight:600}.bbk-email-notifications .form-row__help{color:var(--text-muted);font-size:12px}.bbk-email-notifications .form-row__control{flex:1}.bbk-email-notifications .form-row__control input[type=text],.bbk-email-notifications .form-row__control select{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);font-size:13.5px;height:40px;padding:0 12px;transition:border-color .15s;width:100%}.bbk-email-notifications .form-row__control input[type=text]:focus,.bbk-email-notifications .form-row__control select:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-email-notifications .form-row__control input[type=text]:disabled,.bbk-email-notifications .form-row__control select:disabled{cursor:not-allowed;opacity:.6}.bbk-email-hint{align-items:flex-start;border-left:3px solid var(--brand);display:flex;gap:10px;margin-top:18px;padding:10px 14px}.bbk-email-hint svg{color:var(--brand);flex-shrink:0;margin-top:1px}.bbk-email-hint p{color:var(--text-muted);font-size:12.5px;line-height:1.6;margin:0}@media screen and (min-width:600px){.bbk-email-notifications .form-row{align-items:center;flex-direction:row;gap:16px}.bbk-email-notifications .form-row__label{flex-shrink:0;width:160px}}.form-feedback{align-items:center;border-radius:var(--radius-button);display:flex;font-size:12.5px;gap:10px;margin:0;padding:10px 14px}.form-feedback svg{flex-shrink:0}.form-feedback--green-500{background:var(--green-100);border:1.5px solid var(--green-300);color:var(--green-700)}.form-feedback--error{background:var(--red-100);border:1.5px solid var(--red-300);color:var(--red-700)}.bbk-send-test{border-top:1px solid var(--border-card);margin-top:20px;padding-top:20px}.bbk-send-test__header{display:flex;flex-direction:column;gap:2px;margin-bottom:12px}.bbk-send-test__title{color:var(--text-heading);font-size:13.5px;font-weight:600}.bbk-send-test__help{color:var(--text-muted);font-size:12px}.bbk-send-test__row{align-items:center;display:flex;gap:8px}.bbk-send-test__input{box-sizing:border-box;flex:1;height:40px;padding:0 12px;transition:border-color .15s}.bbk-send-test__input,.bbk-send-test__input[type=text]{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);color:var(--text-heading);font-size:13.5px}.bbk-send-test__input[type=text]{box-shadow:none}.bbk-send-test__input:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-send-test__input:disabled{cursor:not-allowed;opacity:.6}.bbk-send-test__feedback{margin-top:8px}.bbk-preview-url{align-items:center;color:var(--text-muted);display:flex;font-size:12px;gap:8px;margin-top:12px}.bbk-preview-url__label{flex-shrink:0}.bbk-preview-url__link{color:var(--brand);font-weight:600;text-decoration:none}.bbk-preview-url__link:hover{text-decoration:underline}.bbk-mcp-header-status{align-items:center;border-radius:999px;display:inline-flex;font-size:12px;font-weight:600;line-height:1;padding:3px 10px}.bbk-mcp-header-status.is-active{background:var(--green-100);color:var(--green-700)}.bbk-mcp-header-status.is-inactive{background:var(--red-100);color:var(--red-700)}.bbk-agent-api-card{display:flex;flex-direction:column;gap:14px}.bbk-agent-api-card .bbk-mcp-url-block{display:flex;flex-direction:column;gap:8px}.bbk-agent-api-card .bbk-mcp-url-label{color:var(--text-muted);font-size:12px;font-weight:600;letter-spacing:.05em;margin:0;text-transform:uppercase}.bbk-agent-api-card .bbk-mcp-url-row{align-items:center;background:var(--code-bg);border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;gap:8px;padding:10px 12px}.bbk-agent-api-card .bbk-mcp-url-value{color:var(--text-heading);flex:1;font-size:12.5px;line-height:1.45;min-width:0;word-break:break-all}.bbk-agent-api-card .bbk-mcp-divider{background:var(--border-card);height:1px}.bbk-agent-api-card .bbk-mcp-summary{background:var(--surface-card);border:1px solid var(--border-card);border-radius:var(--radius-button);overflow:hidden}.bbk-agent-api-card .bbk-mcp-summary summary{align-items:center;background:var(--surface-sunken);border-bottom:1px solid transparent;color:var(--text-heading);cursor:pointer;display:flex;font-size:13px;font-weight:600;gap:8px;list-style:none;padding:11px 12px}.bbk-agent-api-card .bbk-mcp-summary summary::-webkit-details-marker{display:none}.bbk-agent-api-card .bbk-mcp-summary summary .bbk-mcp-summary-chevron{color:var(--text-muted);display:inline-flex;line-height:1}.bbk-agent-api-card .bbk-mcp-summary summary .bbk-mcp-summary-chevron svg{display:block;transition:transform .2s}.bbk-agent-api-card .bbk-mcp-summary[open] summary{border-bottom-color:var(--border-card)}.bbk-agent-api-card .bbk-mcp-summary[open] summary .bbk-mcp-summary-chevron svg{transform:rotate(90deg)}.bbk-agent-api-card .bbk-mcp-summary .bbk-mcp-summary__content{background:var(--surface-sunken);border-top:1px solid var(--border-card);display:flex;flex-direction:column;gap:10px;padding:12px}.bbk-agent-api-card .bbk-mcp-config-block{display:flex;flex-direction:column;gap:10px}.bbk-agent-api-card .bbk-mcp-config-title{color:var(--text-muted);font-size:12px;font-weight:600;letter-spacing:.05em;margin:0;text-transform:uppercase}.bbk-agent-api-card .bbk-mcp-steps{display:flex;flex-direction:column;gap:10px;list-style:none;margin:0;padding-left:0}.bbk-agent-api-card .bbk-mcp-steps li{-moz-column-gap:10px;column-gap:10px;display:grid;grid-template-columns:24px 1fr;row-gap:2px}.bbk-agent-api-card .bbk-mcp-steps li:before{align-items:center;background:var(--surface-card);border:1px solid var(--border-card);border-radius:50%;color:var(--text-muted);content:counter(bbk-mcp-step);counter-increment:bbk-mcp-step;display:inline-flex;font-size:11px;font-weight:700;height:20px;justify-content:center;margin-top:1px;width:20px}.bbk-agent-api-card .bbk-mcp-steps{counter-reset:bbk-mcp-step}.bbk-agent-api-card .bbk-mcp-steps span,.bbk-agent-api-card .bbk-mcp-steps strong{grid-column:2}.bbk-agent-api-card .bbk-mcp-steps strong{color:var(--text-heading);font-size:13px;font-weight:600}.bbk-agent-api-card .bbk-mcp-steps span{color:var(--text-muted);font-size:12.5px;line-height:1.5}.bbk-agent-api-card .bbk-mcp-code-block{background:var(--code-bg);border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;flex-direction:column;gap:8px;padding:10px}.bbk-agent-api-card .bbk-mcp-code-block .bk-btn{align-self:flex-end}.bbk-agent-api-card .bbk-mcp-code-block pre{background:none;border:none;margin:0;overflow-x:auto;padding:0}.bbk-agent-api-card .bbk-mcp-code-block code{font-size:12px;line-height:1.5;white-space:pre}.bbk-agent-api-card .bbk-mcp-info-box{align-items:flex-start;background:var(--amber-100);border-left:3px solid var(--amber-700);margin-top:2px;padding:10px 14px}.bbk-agent-api-card .bbk-mcp-info-box p{font-size:12.5px;line-height:1.6;margin:0}.bbk-agent-api-card p{color:var(--text-muted);font-size:13px;margin:0}.bbk-agent-api-card p code{font-size:12px}.bbk-agent-api-card .bbk-notice{margin-top:2px}.bbk-agent-api-card__action{margin-top:6px}.bbk-agent-api-card__action .bk-btn{justify-content:center;width:100%}@media screen and (min-width:600px){.bbk-agent-api-card__action .bk-btn{width:auto}}@media screen and (max-width:640px){.bbk-agent-api-card .bbk-mcp-url-row{align-items:stretch;flex-direction:column}.bbk-agent-api-card .bbk-mcp-code-block .bk-btn,.bbk-agent-api-card .bbk-mcp-url-row .bk-btn{justify-content:center;width:100%}}.bbk-tools-abilities-panel .bk-dashboard-card{margin-bottom:16px}.bbk-tools-placeholder{color:var(--text-muted);font-size:13px;margin:0}.bbk-tools-toolbar{align-items:center;display:flex;flex-wrap:wrap;gap:12px;justify-content:space-between;margin-bottom:12px}.bbk-tools-search-wrap{flex:1;min-width:200px;position:relative}.bbk-tools-search-wrap svg{color:var(--text-muted);left:10px;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%)}.bbk-tools-search-wrap input[type=search].bbk-tools-search{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-shadow:none;box-sizing:border-box;color:var(--text-heading);font-size:13px;height:32px;outline:none;padding:0 12px 0 34px;transition:border-color .15s;width:100%}.bbk-tools-search-wrap input[type=search].bbk-tools-search:focus{border-color:var(--brand);box-shadow:var(--focus-ring)}.bbk-tools-search-wrap input[type=search].bbk-tools-search::-webkit-search-cancel-button{display:none}.bbk-tools-toolbar-actions{align-items:center;display:flex;flex-shrink:0;gap:8px}.bbk-tools-enabled-count{color:var(--text-muted);font-size:12px;padding:0 4px;white-space:nowrap}.bbk-tools-no-results{color:var(--text-muted);font-size:13px;padding:20px 12px;text-align:center}.bk-btn-sm{font-size:12px;gap:5px;padding:6px 12px}.bk-btn-sm svg{height:13px;width:13px}.bbk-tools-table-wrap{border:1px solid var(--border-card);border-radius:var(--radius-button);overflow-x:auto}.bbk-tools-table{border-collapse:collapse;min-width:700px;width:100%}.bbk-tools-table thead th{background:var(--surface-sunken);border-bottom:1px solid var(--border-card);color:var(--text-muted);font-size:12px;letter-spacing:.4px;padding:11px 12px;text-align:left;text-transform:uppercase}.bbk-tools-table thead th.bbk-tools-col-expand{padding:11px 8px;width:40px}.bbk-tools-table thead th.bbk-tools-col-help{text-align:center;width:60px}.bbk-tools-table thead th.bbk-tools-col-role{width:160px}.bbk-tools-table thead th.bbk-tools-col-enabled{text-align:center;width:80px}.bbk-tools-table tbody td{border-bottom:1px solid var(--border-card);font-size:13px;padding:12px;vertical-align:middle}.bbk-tools-table tbody td.bbk-tools-col-expand{padding:12px 8px}.bbk-tools-table tbody td.bbk-tools-col-enabled,.bbk-tools-table tbody td.bbk-tools-col-help{text-align:center}.bbk-tools-table tbody tr.is-disabled td{opacity:.58}.bbk-tools-table .bbk-tools-role-warning{color:var(--amber-700);font-size:11px;line-height:1.3;margin:6px 0 0}.bbk-tools-table select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--surface-card);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 fill=%27none%27 stroke=%27%23485a69%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272.5%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27m6 9 6 6 6-6%27/%3E%3C/svg%3E");background-position:right 8px center;background-repeat:no-repeat;border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);cursor:pointer;font-size:13px;height:32px;padding:0 28px 0 10px;transition:border-color .15s;width:100%}.bbk-tools-table select:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-tools-toggle{cursor:pointer;display:inline-block;height:24px;position:relative;vertical-align:middle;width:44px}.bbk-tools-toggle input{cursor:pointer;height:100%;inset:0;margin:0;opacity:0;position:absolute;width:100%;z-index:1}.bbk-tools-toggle:before{background:var(--border-strong);border-radius:12px;content:"";inset:0;position:absolute;transition:background .2s}.bbk-tools-toggle:after{background:var(--surface-card);border-radius:50%;box-shadow:0 1px 3px rgba(0,0,0,.2);content:"";height:20px;left:2px;position:absolute;top:2px;transition:transform .2s;width:20px}.bbk-tools-toggle:has(input:checked):before{background:var(--brand)}.bbk-tools-toggle:has(input:checked):after{transform:translateX(20px)}.bbk-tools-expand-btn{align-items:center;background:none;border:none;border-radius:4px;color:var(--text-muted);cursor:pointer;display:inline-flex;justify-content:center;line-height:1;padding:4px}.bbk-tools-expand-btn svg{display:block;transition:transform .2s}.bbk-tools-expand-btn.is-open svg{transform:rotate(90deg)}.bbk-tools-expand-btn:hover{color:var(--brand)}.bbk-tools-help-btn{align-items:center;background:var(--surface-sunken);border:1px solid var(--border-card);border-radius:50%;color:var(--text-muted);cursor:pointer;display:inline-flex;font-size:13px;font-weight:700;height:22px;justify-content:center;line-height:1;padding:0;transition:background .15s,color .15s,border-color .15s;width:22px}.bbk-tools-help-btn.is-active,.bbk-tools-help-btn:hover{background:var(--brand);border-color:var(--brand);color:var(--text-invert)}.bbk-tools-table tbody tr:has(+.bbk-tools-info-row)>td:first-child{border-left:3px solid var(--brand)}.bbk-tools-info-row td{border-bottom:1px solid var(--border-card);border-left:3px solid var(--brand);padding:0}.bbk-tools-info-panel{background:var(--surface-sunken);padding:16px 20px}.bbk-tools-info-desc{color:var(--text-heading);font-size:13px;margin:0}.bbk-tools-info-layout{align-items:start;display:grid;gap:10px 24px;grid-template-columns:140px 1fr}.bbk-tools-info-label{color:var(--brand);font-size:11px;font-weight:700;letter-spacing:.6px;padding-top:2px;text-transform:uppercase}.bbk-tools-info-criteria{color:var(--text-heading);font-size:13px;line-height:1.5;margin:0}.bbk-tools-examples-list{display:flex;flex-direction:column;gap:4px}.bbk-tools-example{align-items:flex-start;color:var(--text-heading);display:flex;font-size:12px;gap:8px;padding:3px 0}.bbk-tools-example:before{color:var(--brand);content:">_";flex-shrink:0;font-family:monospace;font-size:11px;font-style:normal;font-weight:600;padding-top:1px}.bbk-tools-actions{display:flex;justify-content:flex-end;margin-top:16px}.bbk-upload-limit-card,.bbk-upload-limit-layout{display:flex;flex-direction:column;gap:20px}@media screen and (min-width:960px){.bbk-upload-limit-layout{align-items:start;display:grid;gap:20px 28px;grid-template-areas:"toggle size" "message preview" "image preview";grid-template-columns:1.2fr 1fr}}.bbk-upload-limit-row--toggle{align-items:flex-start;display:flex;gap:14px}@media screen and (min-width:960px){.bbk-upload-limit-row--toggle{grid-area:toggle}.bbk-upload-limit-field--size{align-items:flex-end;grid-area:size;justify-self:end;max-width:260px;text-align:right}.bbk-upload-limit-field--message{grid-area:message}.bbk-upload-limit-field--image{grid-area:image}.bbk-upload-limit-field--preview{grid-area:preview;height:100%}.bbk-upload-limit-row--toggle{-ms-grid-column:1;-ms-grid-row:1}.bbk-upload-limit-field--size{-ms-grid-column:3;-ms-grid-row:1}.bbk-upload-limit-field--message{-ms-grid-column:1;-ms-grid-row:3}.bbk-upload-limit-field--image{-ms-grid-column:1;-ms-grid-row:5}.bbk-upload-limit-field--preview{-ms-grid-row:3;-ms-grid-row-span:3;-ms-grid-column:3}}.bbk-upload-limit-row-text strong{color:var(--text-heading);display:block;font-size:13px;margin-bottom:2px}.bbk-upload-limit-row-text p{color:var(--text-muted);font-size:12px;margin:0}.bbk-upload-limit-field{display:flex;flex-direction:column;gap:6px}.bbk-upload-limit-field>.bbk-upload-limit-field-label,.bbk-upload-limit-field>label{color:var(--text-heading);font-size:13px;font-weight:600}.bbk-upload-limit-field-header{align-items:center;display:flex;gap:12px;justify-content:space-between}.bbk-upload-limit-hint{color:var(--text-muted);font-size:11px;margin:0}.bbk-upload-limit-max-size-input{align-items:center;display:flex;gap:8px;max-width:160px}.bbk-upload-limit-max-size-input input[type=number]{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);flex:1;font-size:13px;height:32px;padding:0 10px}.bbk-upload-limit-max-size-input input[type=number]:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-upload-limit-max-size-input input[type=number]:disabled{cursor:not-allowed;opacity:.6}.bbk-upload-limit-max-size-input span{color:var(--text-muted);font-size:12px}.bbk-upload-limit-message-input{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:1.5;min-height:140px;padding:10px 12px;resize:vertical;width:100%}.bbk-upload-limit-message-input:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-upload-limit-message-input:disabled{cursor:not-allowed;opacity:.6}.bbk-upload-limit-image-preview img{border:1px solid var(--border-card);border-radius:var(--radius-button);display:block;height:auto;max-height:160px;max-width:240px;width:auto}.bbk-upload-limit-image-actions{display:flex;gap:8px}.bbk-upload-limit-mock-overlay{align-items:center;background:rgba(0,0,0,.55);border-radius:var(--radius-button);box-sizing:border-box;display:flex;justify-content:center;padding:24px}@media screen and (min-width:960px){.bbk-upload-limit-mock-overlay{height:100%}}.bbk-upload-limit-mock-dialog{background:#fff;border-radius:10px;box-shadow:0 20px 50px rgba(0,0,0,.3);box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;padding:28px 28px 24px;position:relative;width:100%}.bbk-upload-limit-mock-close{color:#50575e;font-size:20px;height:32px;line-height:32px;position:absolute;right:12px;text-align:center;top:12px;width:32px}.bbk-upload-limit-mock-title{color:#1d2327;font-size:18px;font-weight:600;margin:0 28px 14px 0}.bbk-upload-limit-mock-body{color:#1d2327;font-size:14px;line-height:1.6}.bbk-upload-limit-mock-body a{color:#2271b1}.bbk-upload-limit-mock-body strong{font-weight:600}.bbk-upload-limit-mock-files{background:#f6f7f7;border-radius:6px;font-size:13px;list-style:disc;list-style-position:inside;margin:14px 0 0;padding:10px 14px}.bbk-upload-limit-mock-files li{word-break:break-all}.bbk-upload-limit-mock-file-size{color:var(--red-700);font-weight:700}.bbk-upload-limit-mock-image{border:1px solid #dcdcde;border-radius:6px;display:block;height:auto;margin-top:16px;max-width:100%}.upload-zone{background:var(--surface-card);border:2px dashed var(--border-card);border-radius:var(--radius-button);cursor:pointer;padding:28px;position:relative;text-align:center;transition:all .2s}.upload-zone.upload-zone--dragging,.upload-zone:hover{background:var(--brand-soft);border-color:var(--brand)}.upload-zone input[type=file]{cursor:pointer;height:100%;inset:0;opacity:0;position:absolute;width:100%}.upload-zone p{color:var(--text-muted);font-size:13px}.upload-zone p strong{color:var(--brand);font-weight:500}.upload-zone .upload-hint{color:var(--text-muted);font-size:11.5px;margin-top:4px}.upload-zone-icon{align-items:center;background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:8px;box-shadow:var(--shadow-pluma);color:var(--text-muted);display:flex;height:40px;justify-content:center;margin:0 auto 10px;width:40px}.file-selected{align-items:center;background:var(--green-100);border:1.5px solid var(--green-300);border-radius:var(--radius-button);color:var(--green-700);display:flex;gap:10px;padding:10px 14px}.file-selected span{font-size:.85rem;font-weight:500}.file-selected .file-name{font-size:.75rem}.bk-export-form{display:flex;flex-direction:column;gap:16px}.bk-filters-grid{display:grid;gap:16px;grid-template-columns:1fr 1fr}@media(max-width:600px){.bk-filters-grid{grid-template-columns:1fr}}.bk-filter-group{display:flex;flex-direction:column;gap:8px}.bk-filter-label{color:var(--text-muted);font-size:12.5px;font-weight:500}.bk-chip-group{display:flex;flex-wrap:wrap;gap:6px}.bk-chip{align-items:center;background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:20px;color:var(--text-muted);cursor:pointer;display:inline-flex;font-size:12.5px;font-weight:500;gap:6px;line-height:1;padding:5px 12px;transition:border-color .15s,background .15s,color .15s}.bk-chip.bk-chip--active,.bk-chip:hover{border-color:var(--brand);color:var(--brand)}.bk-chip.bk-chip--active{background:var(--brand-soft)}.bk-chip.bk-chip--good.bk-chip--active{background:var(--green-100);border-color:var(--green-500);color:var(--green-500)}.bk-chip.bk-chip--mid.bk-chip--active{background:var(--amber-100);border-color:var(--amber-700);color:var(--amber-700)}.bk-chip.bk-chip--bad.bk-chip--active{background:var(--red-100);border-color:var(--red-500);color:var(--red-500)}.bk-size-dot{border-radius:50%;display:inline-block;flex-shrink:0;height:8px;width:8px}.bk-size-dot.bk-size-dot--good{background:var(--green-500)}.bk-size-dot.bk-size-dot--mid{background:var(--amber-700)}.bk-size-dot.bk-size-dot--bad{background:var(--red-500)}.bk-size-legend{background:var(--surface-sunken);border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;flex-wrap:wrap;gap:20px;padding:12px 16px}.bk-size-legend__item{align-items:center;color:var(--text-muted);display:flex;font-size:12.5px;gap:5px}.bk-size-legend__label{font-weight:600;margin-right:2px}.bk-size-legend__label.bk-size-legend__label--good{color:var(--green-500)}.bk-size-legend__label.bk-size-legend__label--mid{color:var(--amber-700)}.bk-size-legend__label.bk-size-legend__label--bad{color:var(--red-500)}.bk-export-count{color:var(--text-muted);font-size:13px;margin:0}.bk-export-count strong{color:var(--text-heading);font-weight:600}.bk-footer-main{animation:bk-fadeUp .5s ease both;border-top:1px solid var(--border-card);margin-top:48px;padding-top:40px}.bk-footer-main__inner{background:var(--surface-card);border:1px solid var(--border-card);border-radius:var(--radius-large);box-shadow:var(--shadow-pluma);display:grid;gap:48px;grid-template-columns:60fr 40fr;padding:36px 40px}.bk-footer-main__icon{align-items:center;background:var(--brand-soft);border-radius:var(--radius-button);display:flex;flex-shrink:0;height:32px;justify-content:center;width:32px}.bk-footer-main__icon svg{fill:none;height:16px;stroke:var(--brand);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:16px}.bk-footer-main__section-title{align-items:center;display:flex;gap:12px;margin-bottom:10px}.bk-footer-main__heading{color:var(--text-heading);font-size:14px;font-weight:600;line-height:1.4;margin:0}.bk-footer-main__heading span{color:var(--text-muted);font-weight:400}.bk-footer-main__description{color:var(--text-muted);font-size:13px;line-height:1.6;margin-bottom:20px;padding-left:44px}.bk-footer-main__divider{background:var(--border-card);height:1px;margin:0 0 16px 44px}.bk-footer-main__links{display:flex;flex-direction:column;gap:10px;list-style:none;margin:0;padding-left:44px}.bk-footer-main__links li{align-items:flex-start;display:flex;gap:8px}.bk-footer-main__links li svg{fill:none;flex-shrink:0;height:13px;margin-top:2px;opacity:.55;stroke:var(--brand);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:13px}.bk-footer-main__links a{color:var(--brand);font-size:13px;line-height:1.45;text-decoration:none;transition:color .15s}.bk-footer-main__links a:hover{color:var(--brand-hover);text-decoration:underline}.bk-footer-main__links a code{background:var(--brand-soft);border-radius:4px;font-family:monospace;font-size:12px;padding:1px 4px}.bk-footer-main__team{border-left:1px solid var(--border-card);padding-left:40px}.bk-footer-main__team-title{align-items:flex-start;display:flex;gap:12px;margin-bottom:10px}.bk-footer-main__team-heading{color:var(--text-heading);font-size:14px;font-weight:600;line-height:1.4;margin:0}.bk-footer-main__team-description{color:var(--text-muted);font-size:13px;line-height:1.6;margin-bottom:20px}.bk-footer-main__services{display:flex;flex-direction:column;gap:9px;list-style:none;margin:0 0 24px;padding:0}.bk-footer-main__services li{align-items:flex-start;color:var(--text-heading);display:flex;font-size:13px;gap:9px;line-height:1.4}.bk-footer-main__services li svg{fill:none;flex-shrink:0;height:14px;opacity:.7;stroke:var(--brand);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:14px}.bk-footer-main__cta{align-items:center;border:1px solid rgba(35,146,149,.35);border-radius:var(--radius-button);color:var(--brand);display:inline-flex;font-size:13px;font-weight:500;gap:6px;padding:9px 18px;text-decoration:none;transition:background .15s,border-color .15s,color .15s}.bk-footer-main__cta:hover{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-hover)}.bk-footer-main__cta svg{fill:none;height:13px;stroke:currentcolor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2;width:13px}@media(max-width:780px){.bk-footer-main__inner{grid-template-columns:1fr}.bk-footer-main__team{border-left:none;border-top:1px solid var(--border-card);padding-left:0;padding-top:28px}}#wpcontent{padding-left:0}ul#adminmenu a.wp-has-current-submenu:after,ul#adminmenu>li.current>a.current:after{border-right-color:#eff4f8}#wpbody-content{padding-bottom:0}#wpbody-content>.wrap{margin:0;padding:0}#wpbody-content>.notice,#wpfooter,.notice.notice-warning.update-nag,.wp-core-ui .notice.is-dismissible{display:none!important}#bbk-media-library-app{background:var(--bg-page);border-bottom:4px solid var(--border-card);color:var(--text-heading);line-height:1.5;min-height:100vh;padding:40px 24px}1 #bbk-media-library-app{--primary:#239295;--primary-dark:#1f8288;--accent:#ffc629;--accent-dark:#e8a100;--text:#132633;--text-light:#22394a;--text-muted:#54707e;--border:#dce7f0;--border-strong:#c3d4e0;--background:#eff4f8;--surface:#fff;--bg-cool:#e7f3f3;--green-500:#1f9d6b;--green-600:#177a52;--red-500:#d1503c;--green-100:#ecfdf5;--green-300:#a7d9c4;--green-700:#065f46;--red-100:#fef2f2;--red-300:#f3b4ab;--red-700:#7f1d1d;--amber-100:#fff3ce;--amber-700:#92400e;--shadow-pluma:0 1px 2px rgba(19,38,51,.06),0 2px 8px rgba(19,38,51,.05);--shadow-profunda:0 4px 12px rgba(19,38,51,.08),0 32px 64px -16px rgba(31,130,136,.22);--shadow-panel:0 0 0 1px rgba(19,38,51,.06),0 16px 48px -12px rgba(19,38,51,.18);--radius-button:8px;--radius-medium:10px;--radius-large:16px;--focus-ring:0 0 0 3px rgba(35,146,149,.2);--transition-fast:150ms cubic-bezier(0.3,0,0.2,1);--transition-base:280ms cubic-bezier(0.3,0,0.2,1);--code-bg:#eaf0f5;--brand:var(--primary);--brand-hover:var(--primary-dark);--brand-soft:var(--bg-cool);--cta:var(--accent);--cta-hover:var(--accent-dark);--cta-ink:var(--text);--bg-page:var(--background);--surface-card:var(--surface);--surface-sunken:var(--background);--text-heading:var(--text);--text-body:var(--text-light);--text-invert:var(--surface);--border-card:var(--border)}@keyframes bk-fadeDown{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes bk-fadeUp{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes bk-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.bk-btn{align-items:center;border:none;border-radius:var(--radius-button);cursor:pointer;display:flex;font-size:.9;font-weight:500;gap:7px;padding:13px 18px;text-decoration:none;transition:all .15s;white-space:nowrap}.bk-btn:active{transform:translateY(0)}.bk-btn:disabled{cursor:not-allowed;opacity:.6;pointer-events:none}.bk-btn.bk-btn-primary{background:var(--brand);box-shadow:0 2px 8px rgba(35,146,149,.25);color:var(--text-invert)}.bk-btn.bk-btn-primary:hover{background:var(--brand-hover);box-shadow:0 4px 12px rgba(35,146,149,.35);transform:translateY(-1px)}.bk-btn.bk-btn-secondary{background:transparent;border:1px solid rgba(35,146,149,.35);color:var(--brand)}.bk-btn.bk-btn-secondary:hover{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-hover)}.bk-btn.bk-btn-success{background:var(--green-500);box-shadow:0 2px 8px rgba(31,157,107,.25);color:var(--text-invert)}.bk-btn.bk-btn-success:hover{background:var(--green-600);box-shadow:0 4px 12px rgba(31,157,107,.35);transform:translateY(-1px)}.bbk-notice{align-items:center;border-radius:var(--radius-button);display:flex;font-size:.85rem;gap:10px;margin:0;padding:10px 14px}.bbk-notice svg{flex-shrink:0}.bbk-notice--green-500{background:var(--green-100);border:1.5px solid var(--green-300);color:var(--green-700)}.bbk-notice--error{background:var(--red-100);border:1.5px solid var(--red-300);color:var(--red-700)}.bbk-notice--success{background:var(--green-100);border:1.5px solid var(--green-300);color:var(--green-700)}.bk-app{margin:0 auto;max-width:1180px}.bbk-admin-tabs{border-bottom:1px solid var(--border-card);display:flex;flex-wrap:wrap;margin:0 0 24px}.bbk-admin-tab{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:none;border-bottom:4px solid transparent;border-top-left-radius:6px;border-top-right-radius:6px;color:var(--text-muted);cursor:pointer;display:inline-flex;font-size:13px;font-weight:500;gap:6px;margin-bottom:-1px;padding:10px 16px;transition:color .15s ease,border-color .15s ease,background .15s ease}.bbk-admin-tab svg{flex-shrink:0;height:20px;width:20px}.bbk-admin-tab.is-active,.bbk-admin-tab:hover{color:var(--text-heading)}.bbk-admin-tab.is-active{background:var(--surface-card);border-bottom-color:var(--cta);font-weight:600}.bbk-admin-tab.is-active .bbk-admin-tab__badge{background:var(--cta);color:var(--cta-ink);opacity:1;transition:background .15s ease,opacity .15s ease}.bbk-admin-tab__badge{align-items:center;background:var(--text-muted);border-radius:9px;color:var(--text-invert);display:inline-flex;font-size:11px;font-weight:700;height:18px;justify-content:center;line-height:1;min-width:18px;opacity:.4;padding:0 5px}.bk-header-main{align-items:center;animation:bk-fadeDown .5s ease both;display:flex;gap:16px;margin-bottom:36px}.bk-header-main .bk-icon{align-items:center;background:var(--brand);border-radius:var(--radius-button);box-shadow:0 4px 12px rgba(35,146,149,.3);display:flex;flex-shrink:0;height:48px;justify-content:center;width:48px}.bk-header-main .bk-icon svg{color:var(--text-invert)}.bk-header-main .bk-title{color:var(--text-heading);font-size:22px;font-weight:600;letter-spacing:-.3px;margin:0;padding:0}.bk-header-main .bk-title span{color:var(--brand)}.bk-header-main .bk-subtitle{color:var(--text-muted);font-size:13.5px;margin:0}.bk-dashboard-card{animation:bk-fadeUp .5s ease both;background:var(--surface-card);border:1px solid var(--border-card);border-radius:var(--radius-large);box-shadow:var(--shadow-pluma);margin-bottom:16px;overflow:hidden;padding:0}.bk-dashboard-card .card-header{align-items:flex-start;border-bottom:1px solid var(--border-card);display:flex;gap:12px;justify-content:space-between;padding:20px 24px}.bk-dashboard-card .card-header-main{align-items:center;display:flex;gap:12px;min-width:0}.bk-dashboard-card .card-header-meta{flex-shrink:0}.bk-dashboard-card .card-header-icon{align-items:center;border-radius:8px;display:flex;flex-shrink:0;height:36px;justify-content:center;width:36px}.bk-dashboard-card .card-header-icon.icon-accent{background:var(--brand-soft);color:var(--brand)}.bk-dashboard-card .card-header-icon.icon-success{background:var(--green-100);color:var(--green-500)}.bk-dashboard-card .card-header-icon.icon-warning{background:var(--amber-100);color:var(--amber-700)}.bk-dashboard-card .card-header-text h2{color:var(--text-heading);font-size:14.5px;font-weight:600;letter-spacing:-.1px;margin:0}.bk-dashboard-card .card-header-text p{color:var(--text-muted);font-size:12.5px;margin-bottom:0;margin-top:1px}.bk-dashboard-card .card-body{padding:24px}.bk-card-footer{display:flex;flex-direction:column;gap:12px;margin-top:16px}.bk-card-footer .bk-btn{justify-content:center;width:100%}@media screen and (min-width:600px){.bk-card-footer{align-items:flex-end;flex-direction:row}.bk-card-footer .bk-card-footer__info{flex:1;min-width:0}.bk-card-footer .bk-btn{flex-shrink:0;margin-left:auto;width:25%}}.bk-card-footer__info{display:flex;flex-direction:column;gap:8px;min-width:0}.bbk-summary-grid{display:grid;gap:16px;grid-template-columns:1fr;margin-bottom:16px}@media screen and (min-width:960px){.bbk-summary-grid{grid-template-columns:1fr 1fr}}.bbk-size-summary{display:flex;flex-direction:column;gap:14px}.bbk-size-tiles{display:grid;gap:10px;grid-template-columns:repeat(3,1fr)}.bbk-size-tile{align-items:center;border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;flex-direction:column;padding:10px 8px;text-align:center}.bbk-size-tile__number{font-size:22px;font-weight:700;line-height:1.1}.bbk-size-tile__label{color:var(--text-muted);font-size:11px;line-height:1.3;margin-top:4px;text-transform:uppercase}.bbk-size-tile--good{background:var(--green-100);border-color:var(--green-500)}.bbk-size-tile--good .bbk-size-tile__number{color:var(--green-500)}.bbk-size-tile--medium{background:var(--amber-100);border-color:var(--amber-700)}.bbk-size-tile--medium .bbk-size-tile__number{color:var(--amber-700)}.bbk-size-tile--bad{background:var(--red-100);border-color:var(--red-500)}.bbk-size-tile--bad .bbk-size-tile__number{color:var(--red-500)}.bbk-size-bar__track{background:var(--border-card);border-radius:6px;display:flex;height:6px;overflow:hidden}.bbk-size-bar__segment{height:100%;transition:flex .4s ease}.bbk-size-bar__segment--good{background:var(--green-500)}.bbk-size-bar__segment--medium{background:var(--amber-700)}.bbk-size-bar__segment--bad{background:var(--red-500)}.bbk-size-bar__footer{display:flex;justify-content:space-between;margin-top:6px}.bbk-size-bar__total{color:var(--text-muted);font-size:11px}.bbk-size-bar__total strong{color:var(--text-heading)}.bbk-size-bar__attention{color:var(--red-500);font-size:11px;font-weight:500}.bbk-summary-alt-chart{align-items:center;display:flex;gap:24px;padding:8px 0}.bbk-summary-alt-chart__donut{flex-shrink:0}.bbk-summary-alt-chart__donut circle{transition:stroke-dashoffset .5s ease}.bbk-summary-alt-chart__legend{display:flex;flex-direction:column;gap:8px}.bbk-summary-alt-chart__legend-item{align-items:center;color:var(--text-heading);display:flex;font-size:13px;gap:8px}.bbk-summary-alt-chart__legend-dot{border-radius:50%;flex-shrink:0;height:10px;width:10px}.bbk-summary-alt-chart__legend-dot--missing{background:var(--red-500)}.bbk-summary-alt-chart__legend-dot--present{background:var(--green-500)}.bbk-summary-alt-chart__legend-value{font-weight:700;margin-left:auto;padding-left:16px}.bbk-summary-note{color:var(--text-muted);font-size:12px;margin-top:16px;text-align:center}.bbk-summary-skeleton{display:flex;flex-direction:column;gap:10px;padding:4px 0}.bbk-summary-skeleton__line{animation:bk-skeleton-shimmer 1.4s infinite;background:linear-gradient(90deg,var(--border-card) 25%,var(--surface-card) 50%,var(--border-card) 75%);background-size:200% 100%;border-radius:4px;height:14px}.bbk-summary-skeleton__line--short{width:40%}.bbk-summary-skeleton__line--medium{width:65%}.bbk-summary-skeleton__line--full{width:100%}.bbk-email-notifications{display:flex;flex-direction:column;gap:0}.bbk-email-notifications .form-row{display:flex;flex-direction:column;gap:10px;padding:16px 0}.bbk-email-notifications .form-row:first-of-type{padding-top:0}.bbk-email-notifications .form-row--separated{border-top:1px solid var(--border-card);padding-bottom:0}.bbk-email-notifications .form-row__label{display:flex;flex-direction:column;gap:2px}.bbk-email-notifications .form-row__title{color:var(--text-heading);font-size:13.5px;font-weight:600}.bbk-email-notifications .form-row__help{color:var(--text-muted);font-size:12px}.bbk-email-notifications .form-row__control{flex:1}.bbk-email-notifications .form-row__control input[type=text],.bbk-email-notifications .form-row__control select{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);font-size:13.5px;height:40px;padding:0 12px;transition:border-color .15s;width:100%}.bbk-email-notifications .form-row__control input[type=text]:focus,.bbk-email-notifications .form-row__control select:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-email-notifications .form-row__control input[type=text]:disabled,.bbk-email-notifications .form-row__control select:disabled{cursor:not-allowed;opacity:.6}.bbk-email-hint{align-items:flex-start;border-left:3px solid var(--brand);display:flex;gap:10px;margin-top:18px;padding:10px 14px}.bbk-email-hint svg{color:var(--brand);flex-shrink:0;margin-top:1px}.bbk-email-hint p{color:var(--text-muted);font-size:12.5px;line-height:1.6;margin:0}@media screen and (min-width:600px){.bbk-email-notifications .form-row{align-items:center;flex-direction:row;gap:16px}.bbk-email-notifications .form-row__label{flex-shrink:0;width:160px}}.form-feedback{align-items:center;border-radius:var(--radius-button);display:flex;font-size:12.5px;gap:10px;margin:0;padding:10px 14px}.form-feedback svg{flex-shrink:0}.form-feedback--green-500{background:var(--green-100);border:1.5px solid var(--green-300);color:var(--green-700)}.form-feedback--error{background:var(--red-100);border:1.5px solid var(--red-300);color:var(--red-700)}.bbk-send-test{border-top:1px solid var(--border-card);margin-top:20px;padding-top:20px}.bbk-send-test__header{display:flex;flex-direction:column;gap:2px;margin-bottom:12px}.bbk-send-test__title{color:var(--text-heading);font-size:13.5px;font-weight:600}.bbk-send-test__help{color:var(--text-muted);font-size:12px}.bbk-send-test__row{align-items:center;display:flex;gap:8px}.bbk-send-test__input{box-sizing:border-box;flex:1;height:40px;padding:0 12px;transition:border-color .15s}.bbk-send-test__input,.bbk-send-test__input[type=text]{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);color:var(--text-heading);font-size:13.5px}.bbk-send-test__input[type=text]{box-shadow:none}.bbk-send-test__input:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-send-test__input:disabled{cursor:not-allowed;opacity:.6}.bbk-send-test__feedback{margin-top:8px}.bbk-preview-url{align-items:center;color:var(--text-muted);display:flex;font-size:12px;gap:8px;margin-top:12px}.bbk-preview-url__label{flex-shrink:0}.bbk-preview-url__link{color:var(--brand);font-weight:600;text-decoration:none}.bbk-preview-url__link:hover{text-decoration:underline}.bbk-mcp-header-status{align-items:center;border-radius:999px;display:inline-flex;font-size:12px;font-weight:600;line-height:1;padding:3px 10px}.bbk-mcp-header-status.is-active{background:var(--green-100);color:var(--green-700)}.bbk-mcp-header-status.is-inactive{background:var(--red-100);color:var(--red-700)}.bbk-agent-api-card{display:flex;flex-direction:column;gap:14px}.bbk-agent-api-card .bbk-mcp-url-block{display:flex;flex-direction:column;gap:8px}.bbk-agent-api-card .bbk-mcp-url-label{color:var(--text-muted);font-size:12px;font-weight:600;letter-spacing:.05em;margin:0;text-transform:uppercase}.bbk-agent-api-card .bbk-mcp-url-row{align-items:center;background:var(--code-bg);border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;gap:8px;padding:10px 12px}.bbk-agent-api-card .bbk-mcp-url-value{color:var(--text-heading);flex:1;font-size:12.5px;line-height:1.45;min-width:0;word-break:break-all}.bbk-agent-api-card .bbk-mcp-divider{background:var(--border-card);height:1px}.bbk-agent-api-card .bbk-mcp-summary{background:var(--surface-card);border:1px solid var(--border-card);border-radius:var(--radius-button);overflow:hidden}.bbk-agent-api-card .bbk-mcp-summary summary{align-items:center;background:var(--surface-sunken);border-bottom:1px solid transparent;color:var(--text-heading);cursor:pointer;display:flex;font-size:13px;font-weight:600;gap:8px;list-style:none;padding:11px 12px}.bbk-agent-api-card .bbk-mcp-summary summary::-webkit-details-marker{display:none}.bbk-agent-api-card .bbk-mcp-summary summary .bbk-mcp-summary-chevron{color:var(--text-muted);display:inline-flex;line-height:1}.bbk-agent-api-card .bbk-mcp-summary summary .bbk-mcp-summary-chevron svg{display:block;transition:transform .2s}.bbk-agent-api-card .bbk-mcp-summary[open] summary{border-bottom-color:var(--border-card)}.bbk-agent-api-card .bbk-mcp-summary[open] summary .bbk-mcp-summary-chevron svg{transform:rotate(90deg)}.bbk-agent-api-card .bbk-mcp-summary .bbk-mcp-summary__content{background:var(--surface-sunken);border-top:1px solid var(--border-card);display:flex;flex-direction:column;gap:10px;padding:12px}.bbk-agent-api-card .bbk-mcp-config-block{display:flex;flex-direction:column;gap:10px}.bbk-agent-api-card .bbk-mcp-config-title{color:var(--text-muted);font-size:12px;font-weight:600;letter-spacing:.05em;margin:0;text-transform:uppercase}.bbk-agent-api-card .bbk-mcp-steps{display:flex;flex-direction:column;gap:10px;list-style:none;margin:0;padding-left:0}.bbk-agent-api-card .bbk-mcp-steps li{-moz-column-gap:10px;column-gap:10px;display:grid;grid-template-columns:24px 1fr;row-gap:2px}.bbk-agent-api-card .bbk-mcp-steps li:before{align-items:center;background:var(--surface-card);border:1px solid var(--border-card);border-radius:50%;color:var(--text-muted);content:counter(bbk-mcp-step);counter-increment:bbk-mcp-step;display:inline-flex;font-size:11px;font-weight:700;height:20px;justify-content:center;margin-top:1px;width:20px}.bbk-agent-api-card .bbk-mcp-steps{counter-reset:bbk-mcp-step}.bbk-agent-api-card .bbk-mcp-steps span,.bbk-agent-api-card .bbk-mcp-steps strong{grid-column:2}.bbk-agent-api-card .bbk-mcp-steps strong{color:var(--text-heading);font-size:13px;font-weight:600}.bbk-agent-api-card .bbk-mcp-steps span{color:var(--text-muted);font-size:12.5px;line-height:1.5}.bbk-agent-api-card .bbk-mcp-code-block{background:var(--code-bg);border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;flex-direction:column;gap:8px;padding:10px}.bbk-agent-api-card .bbk-mcp-code-block .bk-btn{align-self:flex-end}.bbk-agent-api-card .bbk-mcp-code-block pre{background:none;border:none;margin:0;overflow-x:auto;padding:0}.bbk-agent-api-card .bbk-mcp-code-block code{font-size:12px;line-height:1.5;white-space:pre}.bbk-agent-api-card .bbk-mcp-info-box{align-items:flex-start;background:var(--amber-100);border-left:3px solid var(--amber-700);margin-top:2px;padding:10px 14px}.bbk-agent-api-card .bbk-mcp-info-box p{font-size:12.5px;line-height:1.6;margin:0}.bbk-agent-api-card p{color:var(--text-muted);font-size:13px;margin:0}.bbk-agent-api-card p code{font-size:12px}.bbk-agent-api-card .bbk-notice{margin-top:2px}.bbk-agent-api-card__action{margin-top:6px}.bbk-agent-api-card__action .bk-btn{justify-content:center;width:100%}@media screen and (min-width:600px){.bbk-agent-api-card__action .bk-btn{width:auto}}@media screen and (max-width:640px){.bbk-agent-api-card .bbk-mcp-url-row{align-items:stretch;flex-direction:column}.bbk-agent-api-card .bbk-mcp-code-block .bk-btn,.bbk-agent-api-card .bbk-mcp-url-row .bk-btn{justify-content:center;width:100%}}.bbk-tools-abilities-panel .bk-dashboard-card{margin-bottom:16px}.bbk-tools-placeholder{color:var(--text-muted);font-size:13px;margin:0}.bbk-tools-toolbar{align-items:center;display:flex;flex-wrap:wrap;gap:12px;justify-content:space-between;margin-bottom:12px}.bbk-tools-search-wrap{flex:1;min-width:200px;position:relative}.bbk-tools-search-wrap svg{color:var(--text-muted);left:10px;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%)}.bbk-tools-search-wrap input[type=search].bbk-tools-search{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-shadow:none;box-sizing:border-box;color:var(--text-heading);font-size:13px;height:32px;outline:none;padding:0 12px 0 34px;transition:border-color .15s;width:100%}.bbk-tools-search-wrap input[type=search].bbk-tools-search:focus{border-color:var(--brand);box-shadow:var(--focus-ring)}.bbk-tools-search-wrap input[type=search].bbk-tools-search::-webkit-search-cancel-button{display:none}.bbk-tools-toolbar-actions{align-items:center;display:flex;flex-shrink:0;gap:8px}.bbk-tools-enabled-count{color:var(--text-muted);font-size:12px;padding:0 4px;white-space:nowrap}.bbk-tools-no-results{color:var(--text-muted);font-size:13px;padding:20px 12px;text-align:center}.bk-btn-sm{font-size:12px;gap:5px;padding:6px 12px}.bk-btn-sm svg{height:13px;width:13px}.bbk-tools-table-wrap{border:1px solid var(--border-card);border-radius:var(--radius-button);overflow-x:auto}.bbk-tools-table{border-collapse:collapse;min-width:700px;width:100%}.bbk-tools-table thead th{background:var(--surface-sunken);border-bottom:1px solid var(--border-card);color:var(--text-muted);font-size:12px;letter-spacing:.4px;padding:11px 12px;text-align:left;text-transform:uppercase}.bbk-tools-table thead th.bbk-tools-col-expand{padding:11px 8px;width:40px}.bbk-tools-table thead th.bbk-tools-col-help{text-align:center;width:60px}.bbk-tools-table thead th.bbk-tools-col-role{width:160px}.bbk-tools-table thead th.bbk-tools-col-enabled{text-align:center;width:80px}.bbk-tools-table tbody td{border-bottom:1px solid var(--border-card);font-size:13px;padding:12px;vertical-align:middle}.bbk-tools-table tbody td.bbk-tools-col-expand{padding:12px 8px}.bbk-tools-table tbody td.bbk-tools-col-enabled,.bbk-tools-table tbody td.bbk-tools-col-help{text-align:center}.bbk-tools-table tbody tr.is-disabled td{opacity:.58}.bbk-tools-table .bbk-tools-role-warning{color:var(--amber-700);font-size:11px;line-height:1.3;margin:6px 0 0}.bbk-tools-table select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--surface-card);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 fill=%27none%27 stroke=%27%23485a69%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272.5%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27m6 9 6 6 6-6%27/%3E%3C/svg%3E");background-position:right 8px center;background-repeat:no-repeat;border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);cursor:pointer;font-size:13px;height:32px;padding:0 28px 0 10px;transition:border-color .15s;width:100%}.bbk-tools-table select:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-tools-toggle{cursor:pointer;display:inline-block;height:24px;position:relative;vertical-align:middle;width:44px}.bbk-tools-toggle input{cursor:pointer;height:100%;inset:0;margin:0;opacity:0;position:absolute;width:100%;z-index:1}.bbk-tools-toggle:before{background:var(--border-strong);border-radius:12px;content:"";inset:0;position:absolute;transition:background .2s}.bbk-tools-toggle:after{background:var(--surface-card);border-radius:50%;box-shadow:0 1px 3px rgba(0,0,0,.2);content:"";height:20px;left:2px;position:absolute;top:2px;transition:transform .2s;width:20px}.bbk-tools-toggle:has(input:checked):before{background:var(--brand)}.bbk-tools-toggle:has(input:checked):after{transform:translateX(20px)}.bbk-tools-expand-btn{align-items:center;background:none;border:none;border-radius:4px;color:var(--text-muted);cursor:pointer;display:inline-flex;justify-content:center;line-height:1;padding:4px}.bbk-tools-expand-btn svg{display:block;transition:transform .2s}.bbk-tools-expand-btn.is-open svg{transform:rotate(90deg)}.bbk-tools-expand-btn:hover{color:var(--brand)}.bbk-tools-help-btn{align-items:center;background:var(--surface-sunken);border:1px solid var(--border-card);border-radius:50%;color:var(--text-muted);cursor:pointer;display:inline-flex;font-size:13px;font-weight:700;height:22px;justify-content:center;line-height:1;padding:0;transition:background .15s,color .15s,border-color .15s;width:22px}.bbk-tools-help-btn.is-active,.bbk-tools-help-btn:hover{background:var(--brand);border-color:var(--brand);color:var(--text-invert)}.bbk-tools-table tbody tr:has(+.bbk-tools-info-row)>td:first-child{border-left:3px solid var(--brand)}.bbk-tools-info-row td{border-bottom:1px solid var(--border-card);border-left:3px solid var(--brand);padding:0}.bbk-tools-info-panel{background:var(--surface-sunken);padding:16px 20px}.bbk-tools-info-desc{color:var(--text-heading);font-size:13px;margin:0}.bbk-tools-info-layout{align-items:start;display:grid;gap:10px 24px;grid-template-columns:140px 1fr}.bbk-tools-info-label{color:var(--brand);font-size:11px;font-weight:700;letter-spacing:.6px;padding-top:2px;text-transform:uppercase}.bbk-tools-info-criteria{color:var(--text-heading);font-size:13px;line-height:1.5;margin:0}.bbk-tools-examples-list{display:flex;flex-direction:column;gap:4px}.bbk-tools-example{align-items:flex-start;color:var(--text-heading);display:flex;font-size:12px;gap:8px;padding:3px 0}.bbk-tools-example:before{color:var(--brand);content:">_";flex-shrink:0;font-family:monospace;font-size:11px;font-style:normal;font-weight:600;padding-top:1px}.bbk-tools-actions{display:flex;justify-content:flex-end;margin-top:16px}.bbk-upload-limit-card,.bbk-upload-limit-layout{display:flex;flex-direction:column;gap:20px}@media screen and (min-width:960px){.bbk-upload-limit-layout{align-items:start;display:grid;gap:20px 28px;grid-template-areas:"toggle size" "message preview" "image preview";grid-template-columns:1.2fr 1fr}}.bbk-upload-limit-row--toggle{align-items:flex-start;display:flex;gap:14px}@media screen and (min-width:960px){.bbk-upload-limit-row--toggle{grid-area:toggle}.bbk-upload-limit-field--size{align-items:flex-end;grid-area:size;justify-self:end;max-width:260px;text-align:right}.bbk-upload-limit-field--message{grid-area:message}.bbk-upload-limit-field--image{grid-area:image}.bbk-upload-limit-field--preview{grid-area:preview;height:100%}.bbk-upload-limit-row--toggle{-ms-grid-column:1;-ms-grid-row:1}.bbk-upload-limit-field--size{-ms-grid-column:3;-ms-grid-row:1}.bbk-upload-limit-field--message{-ms-grid-column:1;-ms-grid-row:3}.bbk-upload-limit-field--image{-ms-grid-column:1;-ms-grid-row:5}.bbk-upload-limit-field--preview{-ms-grid-row:3;-ms-grid-row-span:3;-ms-grid-column:3}}.bbk-upload-limit-row-text strong{color:var(--text-heading);display:block;font-size:13px;margin-bottom:2px}.bbk-upload-limit-row-text p{color:var(--text-muted);font-size:12px;margin:0}.bbk-upload-limit-field{display:flex;flex-direction:column;gap:6px}.bbk-upload-limit-field>.bbk-upload-limit-field-label,.bbk-upload-limit-field>label{color:var(--text-heading);font-size:13px;font-weight:600}.bbk-upload-limit-field-header{align-items:center;display:flex;gap:12px;justify-content:space-between}.bbk-upload-limit-hint{color:var(--text-muted);font-size:11px;margin:0}.bbk-upload-limit-max-size-input{align-items:center;display:flex;gap:8px;max-width:160px}.bbk-upload-limit-max-size-input input[type=number]{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);flex:1;font-size:13px;height:32px;padding:0 10px}.bbk-upload-limit-max-size-input input[type=number]:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-upload-limit-max-size-input input[type=number]:disabled{cursor:not-allowed;opacity:.6}.bbk-upload-limit-max-size-input span{color:var(--text-muted);font-size:12px}.bbk-upload-limit-message-input{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:1.5;min-height:140px;padding:10px 12px;resize:vertical;width:100%}.bbk-upload-limit-message-input:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-upload-limit-message-input:disabled{cursor:not-allowed;opacity:.6}.bbk-upload-limit-image-preview img{border:1px solid var(--border-card);border-radius:var(--radius-button);display:block;height:auto;max-height:160px;max-width:240px;width:auto}.bbk-upload-limit-image-actions{display:flex;gap:8px}.bbk-upload-limit-mock-overlay{align-items:center;background:rgba(0,0,0,.55);border-radius:var(--radius-button);box-sizing:border-box;display:flex;justify-content:center;padding:24px}@media screen and (min-width:960px){.bbk-upload-limit-mock-overlay{height:100%}}.bbk-upload-limit-mock-dialog{background:#fff;border-radius:10px;box-shadow:0 20px 50px rgba(0,0,0,.3);box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;padding:28px 28px 24px;position:relative;width:100%}.bbk-upload-limit-mock-close{color:#50575e;font-size:20px;height:32px;line-height:32px;position:absolute;right:12px;text-align:center;top:12px;width:32px}.bbk-upload-limit-mock-title{color:#1d2327;font-size:18px;font-weight:600;margin:0 28px 14px 0}.bbk-upload-limit-mock-body{color:#1d2327;font-size:14px;line-height:1.6}.bbk-upload-limit-mock-body a{color:#2271b1}.bbk-upload-limit-mock-body strong{font-weight:600}.bbk-upload-limit-mock-files{background:#f6f7f7;border-radius:6px;font-size:13px;list-style:disc;list-style-position:inside;margin:14px 0 0;padding:10px 14px}.bbk-upload-limit-mock-files li{word-break:break-all}.bbk-upload-limit-mock-file-size{color:var(--red-700);font-weight:700}.bbk-upload-limit-mock-image{border:1px solid #dcdcde;border-radius:6px;display:block;height:auto;margin-top:16px;max-width:100%}.upload-zone{background:var(--surface-card);border:2px dashed var(--border-card);border-radius:var(--radius-button);cursor:pointer;padding:28px;position:relative;text-align:center;transition:all .2s}.upload-zone.upload-zone--dragging,.upload-zone:hover{background:var(--brand-soft);border-color:var(--brand)}.upload-zone input[type=file]{cursor:pointer;height:100%;inset:0;opacity:0;position:absolute;width:100%}.upload-zone p{color:var(--text-muted);font-size:13px}.upload-zone p strong{color:var(--brand);font-weight:500}.upload-zone .upload-hint{color:var(--text-muted);font-size:11.5px;margin-top:4px}.upload-zone-icon{align-items:center;background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:8px;box-shadow:var(--shadow-pluma);color:var(--text-muted);display:flex;height:40px;justify-content:center;margin:0 auto 10px;width:40px}.file-selected{align-items:center;background:var(--green-100);border:1.5px solid var(--green-300);border-radius:var(--radius-button);color:var(--green-700);display:flex;gap:10px;padding:10px 14px}.file-selected span{font-size:.85rem;font-weight:500}.file-selected .file-name{font-size:.75rem}.bk-progress-bar{display:flex;flex-direction:column;gap:6px}.bk-progress-bar__track{background:var(--border-card);border-radius:3px;height:6px;overflow:hidden}.bk-progress-bar__fill{background:var(--brand);height:100%;transition:width var(--transition-base)}.bk-progress-bar__label{color:var(--text-muted);font-size:.75rem}.bbk-import-report{border-top:1px solid var(--border-card);display:flex;flex-direction:column;gap:16px;margin-top:20px;padding-top:20px}.bbk-import-report__head{display:flex;flex-direction:column;gap:12px}@media screen and (min-width:600px){.bbk-import-report__head{align-items:flex-start;flex-direction:row;gap:24px;justify-content:space-between}}.bbk-import-report__head .bk-btn{flex-shrink:0}.bbk-import-report__title{color:var(--text-heading);font-size:1rem;font-weight:600;letter-spacing:-.1px;margin:0}.bbk-import-report__title--ok{color:var(--green-700)}.bbk-import-report__title--attention{color:var(--red-700)}.bbk-import-report__lead{color:var(--text-muted);font-size:.85rem;margin:2px 0 0}.bbk-import-report__tone--ok{color:var(--text-heading)}.bbk-import-report__tone--bad{color:var(--red-700)}.bbk-import-report__tone--neutral{color:var(--text-muted)}.bbk-import-report__note{color:var(--text-muted);font-size:.8rem;margin:0}.bbk-import-report__warning{background:var(--amber-100);border-radius:var(--radius-button);color:var(--amber-700);font-size:.8rem;margin:0;padding:10px 14px}.bbk-import-report__details summary{align-items:center;color:var(--brand);cursor:pointer;display:inline-flex;font-size:.85rem;font-weight:500;gap:8px;list-style:none;padding:4px 0}.bbk-import-report__details summary::-webkit-details-marker{display:none}.bbk-import-report__details summary:before{border-bottom:2px solid;border-right:2px solid;content:"";flex-shrink:0;height:6px;margin:0 2px 0 1px;transform:rotate(-45deg);width:6px}@media(prefers-reduced-motion:no-preference){.bbk-import-report__details summary:before{transition:transform var(--transition-fast)}}.bbk-import-report__details summary:hover{color:var(--brand-hover)}.bbk-import-report__details summary:focus-visible{border-radius:var(--radius-button);box-shadow:var(--focus-ring);outline:none}.bbk-import-report__details[open] summary:before{transform:rotate(45deg)}.bbk-import-report__table-wrap{border:1px solid var(--border-card);border-radius:var(--radius-button);margin-top:8px;max-height:360px;overflow:auto}.bbk-import-report__table-wrap:focus-visible{box-shadow:var(--focus-ring);outline:none}.bbk-import-report__table{border-collapse:collapse;font-size:.78rem;font-variant-numeric:tabular-nums;width:100%}.bbk-import-report__table td,.bbk-import-report__table th{border-bottom:1px solid var(--border-card);padding:8px 12px;text-align:left;vertical-align:top}.bbk-import-report__table tbody tr:last-child td{border-bottom:0}.bbk-import-report__table th{background:var(--surface-card);box-shadow:0 1px 0 var(--border-card);color:var(--text-muted);font-size:.7rem;font-weight:600;letter-spacing:.02em;position:sticky;top:0}.bbk-import-report__table td:nth-child(-n+2),.bbk-import-report__table th:nth-child(-n+2){white-space:nowrap;width:1%}.bbk-import-report__alt{color:var(--text-heading);max-width:320px;min-width:180px;overflow-wrap:anywhere;white-space:pre-wrap}.bbk-import-report__empty{color:var(--text-muted)}.bbk-import-report__status{font-weight:600;white-space:nowrap}.bbk-import-report__reason{color:var(--text-muted);min-width:180px}.bbk-import-report__more{margin-top:8px}.bk-export-form{display:flex;flex-direction:column;gap:16px}.bk-filters-grid{display:grid;gap:16px;grid-template-columns:1fr 1fr}@media(max-width:600px){.bk-filters-grid{grid-template-columns:1fr}}.bk-filter-group{display:flex;flex-direction:column;gap:8px}.bk-filter-label{color:var(--text-muted);font-size:12.5px;font-weight:500}.bk-chip-group{display:flex;flex-wrap:wrap;gap:6px}.bk-chip{align-items:center;background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:20px;color:var(--text-muted);cursor:pointer;display:inline-flex;font-size:12.5px;font-weight:500;gap:6px;line-height:1;padding:5px 12px;transition:border-color .15s,background .15s,color .15s}.bk-chip.bk-chip--active,.bk-chip:hover{border-color:var(--brand);color:var(--brand)}.bk-chip.bk-chip--active{background:var(--brand-soft)}.bk-chip.bk-chip--good.bk-chip--active{background:var(--green-100);border-color:var(--green-500);color:var(--green-500)}.bk-chip.bk-chip--mid.bk-chip--active{background:var(--amber-100);border-color:var(--amber-700);color:var(--amber-700)}.bk-chip.bk-chip--bad.bk-chip--active{background:var(--red-100);border-color:var(--red-500);color:var(--red-500)}.bk-size-dot{border-radius:50%;display:inline-block;flex-shrink:0;height:8px;width:8px}.bk-size-dot.bk-size-dot--good{background:var(--green-500)}.bk-size-dot.bk-size-dot--mid{background:var(--amber-700)}.bk-size-dot.bk-size-dot--bad{background:var(--red-500)}.bk-size-legend{background:var(--surface-sunken);border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;flex-wrap:wrap;gap:20px;padding:12px 16px}.bk-size-legend__item{align-items:center;color:var(--text-muted);display:flex;font-size:12.5px;gap:5px}.bk-size-legend__label{font-weight:600;margin-right:2px}.bk-size-legend__label.bk-size-legend__label--good{color:var(--green-500)}.bk-size-legend__label.bk-size-legend__label--mid{color:var(--amber-700)}.bk-size-legend__label.bk-size-legend__label--bad{color:var(--red-500)}.bk-export-count{color:var(--text-muted);font-size:13px;margin:0}.bk-export-count strong{color:var(--text-heading);font-weight:600}.bk-footer-main{animation:bk-fadeUp .5s ease both;border-top:1px solid var(--border-card);margin-top:48px;padding-top:40px}.bk-footer-main__inner{background:var(--surface-card);border:1px solid var(--border-card);border-radius:var(--radius-large);box-shadow:var(--shadow-pluma);display:grid;gap:48px;grid-template-columns:60fr 40fr;padding:36px 40px}.bk-footer-main__icon{align-items:center;background:var(--brand-soft);border-radius:var(--radius-button);display:flex;flex-shrink:0;height:32px;justify-content:center;width:32px}.bk-footer-main__icon svg{fill:none;height:16px;stroke:var(--brand);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:16px}.bk-footer-main__section-title{align-items:center;display:flex;gap:12px;margin-bottom:10px}.bk-footer-main__heading{color:var(--text-heading);font-size:14px;font-weight:600;line-height:1.4;margin:0}.bk-footer-main__heading span{color:var(--text-muted);font-weight:400}.bk-footer-main__description{color:var(--text-muted);font-size:13px;line-height:1.6;margin-bottom:20px;padding-left:44px}.bk-footer-main__divider{background:var(--border-card);height:1px;margin:0 0 16px 44px}.bk-footer-main__links{display:flex;flex-direction:column;gap:10px;list-style:none;margin:0;padding-left:44px}.bk-footer-main__links li{align-items:flex-start;display:flex;gap:8px}.bk-footer-main__links li svg{fill:none;flex-shrink:0;height:13px;margin-top:2px;opacity:.55;stroke:var(--brand);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:13px}.bk-footer-main__links a{color:var(--brand);font-size:13px;line-height:1.45;text-decoration:none;transition:color .15s}.bk-footer-main__links a:hover{color:var(--brand-hover);text-decoration:underline}.bk-footer-main__links a code{background:var(--brand-soft);border-radius:4px;font-family:monospace;font-size:12px;padding:1px 4px}.bk-footer-main__team{border-left:1px solid var(--border-card);padding-left:40px}.bk-footer-main__team-title{align-items:flex-start;display:flex;gap:12px;margin-bottom:10px}.bk-footer-main__team-heading{color:var(--text-heading);font-size:14px;font-weight:600;line-height:1.4;margin:0}.bk-footer-main__team-description{color:var(--text-muted);font-size:13px;line-height:1.6;margin-bottom:20px}.bk-footer-main__services{display:flex;flex-direction:column;gap:9px;list-style:none;margin:0 0 24px;padding:0}.bk-footer-main__services li{align-items:flex-start;color:var(--text-heading);display:flex;font-size:13px;gap:9px;line-height:1.4}.bk-footer-main__services li svg{fill:none;flex-shrink:0;height:14px;opacity:.7;stroke:var(--brand);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:14px}.bk-footer-main__cta{align-items:center;border:1px solid rgba(35,146,149,.35);border-radius:var(--radius-button);color:var(--brand);display:inline-flex;font-size:13px;font-weight:500;gap:6px;padding:9px 18px;text-decoration:none;transition:background .15s,border-color .15s,color .15s}.bk-footer-main__cta:hover{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-hover)}.bk-footer-main__cta svg{fill:none;height:13px;stroke:currentcolor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2;width:13px}@media(max-width:780px){.bk-footer-main__inner{grid-template-columns:1fr}.bk-footer-main__team{border-left:none;border-top:1px solid var(--border-card);padding-left:0;padding-top:28px}}#wpcontent{padding-left:0}ul#adminmenu a.wp-has-current-submenu:after,ul#adminmenu>li.current>a.current:after{border-right-color:#eff4f8}#wpbody-content{padding-bottom:0}#wpbody-content>.wrap{margin:0;padding:0}#wpbody-content>.notice,#wpfooter,.notice.notice-warning.update-nag,.wp-core-ui .notice.is-dismissible{display:none!important}#bbk-media-library-app{background:var(--bg-page);border-bottom:4px solid var(--border-card);color:var(--text-heading);line-height:1.5;min-height:100vh;padding:40px 24px} -
bubuku-media-library/tags/1.4.3/bubuku-media-library.php
r3741020 r3751624 7 7 * Requires PHP: 7.4 8 8 * Tested up to: 7.0 9 * Version: 1.4. 29 * Version: 1.4.3 10 10 * Author: Bubuku I code 11 11 * Author URI: https://www.bubuku.com/ -
bubuku-media-library/tags/1.4.3/includes/tools/class-tool-import-attachments-alt.php
r3741020 r3751624 47 47 * Sobrescribe ALT existentes (destructive). Se declara idempotent=false adrede aunque repetirla no cambie nada: con destructive+idempotent core exige DELETE en /run y el CSV iría en la query string, inviable con lotes grandes. Con false se mantiene POST + body JSON. 48 48 */ 49 public function get_output_schema(): array { 50 $counter = array( 'type' => 'integer' ); 51 52 return array( 53 'type' => 'object', 54 'properties' => array( 55 'success' => array( 'type' => 'boolean' ), 56 'message' => array( 'type' => 'string' ), 57 'data' => array( 58 'type' => 'object', 59 'properties' => array( 60 'updated' => $counter, 61 'unchanged' => $counter, 62 'cleared' => $counter, 63 'rejected' => $counter, 64 'skipped' => $counter, 65 'errors' => array( 66 'type' => 'array', 67 'items' => array( 'type' => 'string' ), 68 ), 69 'results' => array( 70 'type' => 'array', 71 'items' => array( 72 'type' => 'object', 73 'properties' => array( 74 'index' => $counter, 75 'id' => $counter, 76 'status' => array( 'type' => 'string' ), 77 'reason' => array( 'type' => 'string' ), 78 'normalized' => array( 'type' => 'boolean' ), 79 'superseded_by' => $counter, 80 ), 81 ), 82 ), 83 ), 84 ), 85 ), 86 ); 87 } 88 49 89 public function get_annotations(): array { 50 90 return array( … … 87 127 } 88 128 89 $updated = 0;90 $skipped = 0;91 $errors = array();92 93 $attachment_ids = array_values(94 array_unique(95 array_filter(96 array_map(97 static function ( $row ) {98 return isset( $row['ID'] ) ? absint( $row['ID'] ) : 0;99 },100 $rows101 )102 )103 )104 );105 106 // Prime the post cache for the whole chunk in one query before suspending107 // cache addition below, so get_post_type() in the loop reads from cache108 // instead of running one query per row.109 if ( ! empty( $attachment_ids ) ) {110 get_posts(111 array(112 'post_type' => 'attachment',113 'post_status' => 'inherit',114 'post__in' => $attachment_ids,115 'posts_per_page' => count( $attachment_ids ),116 'no_found_rows' => true,117 'fields' => 'all',118 )119 );120 }121 122 wp_suspend_cache_addition( true );123 124 foreach ( $rows as $index => $row ) {125 $attachment_id = isset( $row['ID'] ) ? absint( $row['ID'] ) : 0;126 $alt_text = isset( $row['Alt Text'] ) ? sanitize_text_field( $row['Alt Text'] ) : '';127 128 if ( 0 === $attachment_id || 'attachment' !== get_post_type( $attachment_id ) ) {129 $errors[] = sprintf(130 /* translators: %1$d: row index, %2$s: attachment ID */131 __( 'Row %1$d: Invalid attachment ID (%2$s).', 'bubuku-media-library' ),132 $index + 1,133 $attachment_id134 );135 continue;136 }137 138 // Object-level check: `upload_files` alone does not imply the caller139 // may edit this specific attachment (e.g. one attached to a private140 // post owned by someone else). Skip it rather than aborting the chunk.141 if ( ! current_user_can( 'edit_post', $attachment_id ) ) {142 ++$skipped;143 continue;144 }145 146 update_post_meta( $attachment_id, '_wp_attachment_image_alt', $alt_text );147 ++$updated;148 }149 150 wp_suspend_cache_addition( false );151 152 foreach ( $attachment_ids as $attachment_id ) {153 clean_post_cache( $attachment_id );154 }155 156 if ( $updated > 0 ) {157 $db = new \Bubuku\Plugins\MediaLibrary\BML_db();158 $db->invalidate_summary_counts_cache();159 }160 161 129 return array( 162 130 'success' => true, 163 'data' => array( 164 'updated' => $updated, 165 'skipped' => $skipped, 166 'errors' => $errors, 167 ), 131 'data' => \Bubuku\Plugins\MediaLibrary\BML_Alt_Importer::import_rows( $rows ), 168 132 ); 169 133 } … … 271 235 $rows[] = array( 272 236 'ID' => absint( $id_value ), 273 'Alt Text' => sanitize_text_field( $alt_value ),237 'Alt Text' => $alt_value, 274 238 ); 275 239 } -
bubuku-media-library/tags/1.4.3/readme.txt
r3741020 r3751624 5 5 Tested up to: 7.0 6 6 Requires PHP: 7.4 7 Stable tag: 1.4. 27 Stable tag: 1.4.3 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 179 179 180 180 == Changelog == 181 = 1.4.3 = 182 - Fixed ALT CSV imports of more than 100 rows, where only the first batch of 100 was applied and the rest were reported as errors. 183 - New import report: after importing, see how many rows were updated, unchanged, rejected or skipped, and review each affected row (CSV row number, ID, ALT text and reason) in a collapsible table. 184 - New "Download pending rows CSV" button: download only the rows that could not be applied, fix them and import them again. 185 - An ALT value is now only counted as updated after checking what was saved. Rows without an Alt Text value are rejected instead of emptying the ALT, and backslashes in ALT texts are kept. 186 - Importing a CSV exported by the plugin no longer keeps the leading apostrophe that the export adds to ALT texts starting with =, +, - or @. 187 - The "Import ALT text" ability now returns the result of every row. 188 - Fixed the ALT accessibility donut on the Overview tab, which only showed the grey track instead of the progress arc. 189 181 190 = 1.4.2 = 182 191 - Abilities now declare whether they only read data (annotations) and describe their output (output schema) for the summary and attachment tools, so MCP clients can use them more reliably. -
bubuku-media-library/tags/1.4.3/src/BML_Plugin.php
r3741020 r3751624 96 96 } 97 97 if ( ! defined( 'BUBUKU_BML_PLUGIN_VERSION' ) ) { 98 define( 'BUBUKU_BML_PLUGIN_VERSION', '1.4. 2' );98 define( 'BUBUKU_BML_PLUGIN_VERSION', '1.4.3' ); 99 99 } 100 100 if ( ! defined( 'BUBUKU_BML_ABILITIES_AVAILABLE' ) ) { -
bubuku-media-library/tags/1.4.3/src/BML_Restapi.php
r3741020 r3751624 706 706 } 707 707 708 $updated = 0; 709 $skipped = 0; 710 $errors = array(); 711 712 $attachment_ids = array_values( 713 array_unique( 714 array_filter( 715 array_map( 716 static function ( $row ) { 717 return isset( $row['ID'] ) ? absint( $row['ID'] ) : 0; 718 }, 719 $rows 720 ) 721 ) 722 ) 723 ); 724 725 // Prime the post cache for the whole chunk in one query before suspending 726 // cache addition below, so get_post_type() in the loop reads from cache 727 // instead of running one query per row. 728 if ( ! empty( $attachment_ids ) ) { 729 get_posts( 730 array( 731 'post_type' => 'attachment', 732 'post_status' => 'inherit', 733 'post__in' => $attachment_ids, 734 'posts_per_page' => count( $attachment_ids ), 735 'no_found_rows' => true, 736 'fields' => 'all', 737 ) 738 ); 739 } 740 741 wp_suspend_cache_addition( true ); 742 743 foreach ( $rows as $index => $row ) { 744 $attachment_id = isset( $row['ID'] ) ? absint( $row['ID'] ) : 0; 745 $alt_text = isset( $row['Alt Text'] ) ? sanitize_text_field( $row['Alt Text'] ) : ''; 746 747 if ( 0 === $attachment_id || 'attachment' !== get_post_type( $attachment_id ) ) { 748 $errors[] = sprintf( 749 /* translators: %1$d: row index, %2$s: attachment ID */ 750 esc_html__( 'Row %1$d: Invalid attachment ID (%2$s).', 'bubuku-media-library' ), 751 $index + 1, 752 $attachment_id 753 ); 754 continue; 755 } 756 757 // Object-level check: `upload_files` alone does not imply the caller 758 // may edit this specific attachment (e.g. one attached to a private 759 // post owned by someone else). Skip it rather than aborting the chunk. 760 if ( ! current_user_can( 'edit_post', $attachment_id ) ) { 761 ++$skipped; 762 continue; 763 } 764 765 update_post_meta( $attachment_id, '_wp_attachment_image_alt', $alt_text ); 766 ++$updated; 767 } 768 769 wp_suspend_cache_addition( false ); 770 771 foreach ( $attachment_ids as $attachment_id ) { 772 clean_post_cache( $attachment_id ); 773 } 774 775 if ( $updated > 0 ) { 776 $this->_db->invalidate_summary_counts_cache(); 777 } 708 // The lock only guards against concurrent chunks from the same user: it is 709 // released as soon as this chunk finishes so the admin importer can send 710 // the next chunk right away instead of receiving a 429 for 10 seconds. 711 try { 712 return $this->process_alt_chunk_rows( $rows ); 713 } finally { 714 $this->release_rate_limit_lock( 'import_alt_chunk' ); 715 } 716 } 717 718 /** 719 * Apply the ALT updates of a chunk. 720 * 721 * @param array $rows Rows with `ID` and `Alt Text` keys. 722 * @return \WP_REST_Response 723 */ 724 private function process_alt_chunk_rows( $rows ) { 725 $report = BML_Alt_Importer::import_rows( $rows ); 778 726 779 727 return rest_ensure_response( 780 728 array( 781 729 'success' => true, 782 'data' => array( 783 'updated' => $updated, 784 'skipped' => $skipped, 785 'errors' => $errors, 786 ), 730 'data' => $report, 787 731 ) 788 732 ); … … 1112 1056 */ 1113 1057 private function acquire_rate_limit_lock( $operation, $ttl_seconds ) { 1114 $user_id = get_current_user_id(); 1115 $transient_key = 'bbk_rl_' . sanitize_key( (string) $operation ) . '_' . absint( $user_id ); 1058 $transient_key = $this->get_rate_limit_key( $operation ); 1116 1059 1117 1060 if ( get_transient( $transient_key ) ) { … … 1122 1065 1123 1066 return true; 1067 } 1068 1069 /** 1070 * Release a rate-limit lock before its TTL expires. 1071 * 1072 * @param string $operation Operation identifier. 1073 * @return void 1074 */ 1075 private function release_rate_limit_lock( $operation ) { 1076 delete_transient( $this->get_rate_limit_key( $operation ) ); 1077 } 1078 1079 /** 1080 * Build the per-user transient key of a rate-limit lock. 1081 * 1082 * @param string $operation Operation identifier. 1083 * @return string 1084 */ 1085 private function get_rate_limit_key( $operation ) { 1086 return 'bbk_rl_' . sanitize_key( (string) $operation ) . '_' . absint( get_current_user_id() ); 1124 1087 } 1125 1088 -
bubuku-media-library/trunk/assets/build/admin.asset.php
r3741020 r3751624 1 <?php return array('dependencies' => array('react', 'wp-element', 'wp-i18n'), 'version' => ' a914bef940db55f8dd3a');1 <?php return array('dependencies' => array('react', 'wp-element', 'wp-i18n'), 'version' => '84752ece8d6b773f404e'); -
bubuku-media-library/trunk/assets/build/admin.js
r3741020 r3751624 1 (()=>{var e,t={980(e,t,a){"use strict";const r=window.React,i=window.wp.element,n=window.wp.i18n,l=function(){return(0,r.createElement)("div",{className:"bk-header-main"},(0,r.createElement)("div",{className:"bk-icon"},(0,r.createElement)("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},(0,r.createElement)("rect",{x:"16",y:"16",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeOpacity:"0.85",strokeWidth:"1.8",fill:"currentColor",fillOpacity:"0.1"}),(0,r.createElement)("circle",{cx:"20",cy:"20",r:"1.5",stroke:"currentColor",strokeOpacity:"0.85",strokeWidth:"1.5",fill:"none"}),(0,r.createElement)("polyline",{points:"34 28 30 23 21 34",stroke:"currentColor",strokeOpacity:"0.85",strokeWidth:"1.8"}),(0,r.createElement)("circle",{cx:"11",cy:"11",r:"8.5",stroke:"currentColor",strokeWidth:"2.5",fill:"currentColor",fillOpacity:"0.18"}),(0,r.createElement)("circle",{cx:"8.5",cy:"8.5",r:"2",stroke:"currentColor",strokeOpacity:"0.4",strokeWidth:"1",fill:"none"}),(0,r.createElement)("line",{x1:"4.5",y1:"17.5",x2:"1",y2:"21",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round"}))),(0,r.createElement)("div",null,(0,r.createElement)("p",{className:"bk-title"},(0,i.createInterpolateElement)((0,n.__)("Bubuku Media Library <span>Settings</span>","bubuku-media-library"),{span:(0,r.createElement)("span",null)})),(0,r.createElement)("p",{className:"bk-subtitle"},(0,n.__)("Manage and optimize your WordPress media library","bubuku-media-library"))))},s=({icon:e,iconVariant:t="icon-accent",title:a,claim:i,animationDelay:n,headerMeta:l=null,children:s})=>{const o=n?{animationDelay:n}:void 0;return(0,r.createElement)("div",{className:"bk-dashboard-card",style:o},(0,r.createElement)("div",{className:"card-header"},(0,r.createElement)("div",{className:"card-header-main"},(0,r.createElement)("div",{className:`card-header-icon ${t}`},e),(0,r.createElement)("div",{className:"card-header-text"},(0,r.createElement)("h2",null,a),(0,r.createElement)("p",null,i))),l&&(0,r.createElement)("div",{className:"card-header-meta"},l)),(0,r.createElement)("div",{className:"card-body"},s))},o=()=>(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),(0,r.createElement)("polyline",{points:"22,6 12,13 2,6"})),c=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),(0,r.createElement)("polyline",{points:"17 21 17 13 7 13 7 21"}),(0,r.createElement)("polyline",{points:"7 3 7 8 15 8"})),u=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),m=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.createElement)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),d=()=>(0,r.createElement)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.createElement)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,r.createElement)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})),b=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,r.createElement)("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})),h=({reportsEmails:e,reportsDisable:t})=>{const[a,l]=(0,i.useState)(""),[h,p]=(0,i.useState)(0),[k,_]=(0,i.useState)(!1),[f,g]=(0,i.useState)(""),[y,E]=(0,i.useState)(""),[v,w]=(0,i.useState)(""),[N,x]=(0,i.useState)(!1),[C,S]=(0,i.useState)(""),[L,z]=(0,i.useState)(""),[M,O]=(0,i.useState)(""),B=`${BbkMediaLibrary.api_url}/set-notification-settings`,A=`${BbkMediaLibrary.api_url}/set-reports-disable`,R=`${BbkMediaLibrary.api_url}/send-manual-report`,T=`${BbkMediaLibrary.api_url}/get-report-preview-url`,j=BbkMediaLibrary._wpnonce,W=BbkMediaLibrary.rest_nonce;return(0,i.useEffect)(()=>{l(null!=e?e:""),p(null!=t?t:0)},[t,e]),(0,i.useEffect)(()=>{fetch(T,{method:"GET",headers:{"X-WP-Nonce":W}}).then(e=>e.json()).then(e=>{e&&e.preview_url&&O(e.preview_url)}).catch(()=>{})},[T,W]),(0,r.createElement)(s,{icon:(0,r.createElement)(o,null),title:(0,n.__)("Email notifications","bubuku-media-library"),claim:(0,n.__)("Receive automatic reports in your inbox","bubuku-media-library")},(0,r.createElement)("form",{id:"bbk-email-notifications-form",onSubmit:e=>{e.preventDefault(),g(""),E("");const t=a.split(",");let r=!0;t.forEach(e=>{e.trim().match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)||(r=!1)}),r?(_(!0),fetch(B,{method:"POST",body:JSON.stringify({emails:a,_wpnonce:j}),headers:{"Content-Type":"application/json","X-WP-Nonce":W}}).then(e=>e.json()).then(e=>{_(!1),e.success?g((0,n.__)("Settings saved successfully","bubuku-media-library")):E((0,n.__)("Error saving settings","bubuku-media-library"))}).catch(()=>{_(!1),E((0,n.__)("Network error. Please try again.","bubuku-media-library"))})):E((0,n.__)("Invalid email format","bubuku-media-library"))},className:"bbk-email-notifications"},(0,r.createElement)("div",{className:"form-row"},(0,r.createElement)("div",{className:"form-row__label"},(0,r.createElement)("span",{className:"form-row__title"},(0,n.__)("Emails to notify","bubuku-media-library")),(0,r.createElement)("span",{className:"form-row__help"},(0,n.__)("Comma separated","bubuku-media-library"))),(0,r.createElement)("div",{className:"form-row__control"},(0,r.createElement)("input",{type:"text",name:"emails",id:"bbk-emails",value:a,onChange:e=>{l(e.target.value),g(""),E("")},disabled:k}))),(0,r.createElement)("div",{className:"form-row form-row--separated"},(0,r.createElement)("div",{className:"form-row__label"},(0,r.createElement)("span",{className:"form-row__title"},(0,n.__)("Weekly reports","bubuku-media-library")),(0,r.createElement)("span",{className:"form-row__help"},(0,n.__)("Sending frequency","bubuku-media-library"))),(0,r.createElement)("div",{className:"form-row__control"},(0,r.createElement)("select",{name:"disable_reports",id:"disable_reports",value:h,onChange:e=>{const t=parseInt(e.target.value,10);p(t),fetch(A,{method:"POST",body:JSON.stringify({disable_reports:t,_wpnonce:j}),headers:{"Content-Type":"application/json","X-WP-Nonce":W}}).then(e=>e.json()).catch(()=>{})}},(0,r.createElement)("option",{value:"0"},(0,n.__)("Disabled","bubuku-media-library")),(0,r.createElement)("option",{value:"1"},(0,n.__)("Weekly","bubuku-media-library")),(0,r.createElement)("option",{value:"2"},(0,n.__)("Monthly","bubuku-media-library")))))),(0,r.createElement)("div",{className:"bbk-email-hint"},(0,r.createElement)(d,null),(0,r.createElement)("p",null,(0,n.__)("You will receive an email report with the file sizes of your media library. Use it to identify heavy images, optimize your site’s performance, and improve your users’ experience.","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-send-test"},(0,r.createElement)("div",{className:"bbk-send-test__header"},(0,r.createElement)("span",{className:"bbk-send-test__title"},(0,n.__)("Send test report","bubuku-media-library")),(0,r.createElement)("span",{className:"bbk-send-test__help"},(0,n.__)("Send the report to one or more addresses right now","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-send-test__row"},(0,r.createElement)("input",{className:"bbk-send-test__input",type:"text",value:v,placeholder:"email@example.com",onChange:e=>{w(e.target.value),S(""),z("")},disabled:N}),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary",onClick:()=>{S(""),z("");const e=v.trim();if(!e)return;const t=e.split(",");let a=!0;t.forEach(e=>{e.trim().match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)||(a=!1)}),a?(x(!0),fetch(R,{method:"POST",body:JSON.stringify({emails:e}),headers:{"Content-Type":"application/json","X-WP-Nonce":W}}).then(e=>e.json()).then(e=>{x(!1),e.sent?(S((0,n.__)("Report sent successfully","bubuku-media-library")),w("")):z(e.message||(0,n.__)("Error sending the report","bubuku-media-library"))}).catch(()=>{x(!1),z((0,n.__)("Network error. Please try again.","bubuku-media-library"))})):z((0,n.__)("Invalid email format","bubuku-media-library"))},disabled:N||!v.trim()},(0,r.createElement)(b,null),N?(0,n.__)("Sending…","bubuku-media-library"):(0,n.__)("Send now","bubuku-media-library"))),(C||L)&&(0,r.createElement)("div",{className:"bbk-send-test__feedback"},C&&(0,r.createElement)("p",{className:"form-feedback form-feedback--success"},(0,r.createElement)(u,null),C),L&&(0,r.createElement)("p",{className:"form-feedback form-feedback--error"},(0,r.createElement)(m,null),L)),M&&(0,r.createElement)("div",{className:"bbk-preview-url"},(0,r.createElement)("span",{className:"bbk-preview-url__label"},(0,n.__)("Preview email in browser:","bubuku-media-library")),(0,r.createElement)("a",{href:M,target:"_blank",rel:"noreferrer",className:"bbk-preview-url__link"},(0,n.__)("Open preview →","bubuku-media-library")))),(0,r.createElement)("div",{className:"bk-card-footer"},(f||y)&&(0,r.createElement)("div",{className:"bk-card-footer__info"},f&&(0,r.createElement)("p",{className:"form-feedback form-feedback--success"},(0,r.createElement)(u,null),f),y&&(0,r.createElement)("p",{className:"form-feedback form-feedback--error"},(0,r.createElement)(m,null),y)),(0,r.createElement)("button",{type:"submit",form:"bbk-email-notifications-form",className:"bk-btn bk-btn-primary",disabled:k},(0,r.createElement)(c,null),k?(0,n.__)("Saving…","bubuku-media-library"):(0,n.__)("Save","bubuku-media-library"))))},p=e=>parseInt(String(e).replace(/\D/g,""),10)||0,k=({good:e,medium:t,bad:a})=>{const i=p(e),l=p(t),s=p(a),o=i+l+s,c=o>0?(s/o*100).toFixed(1):"0",u=[{key:"good",label:(0,n.__)("Good size","bubuku-media-library"),count:null!=e?e:0,variant:"good"},{key:"medium",label:(0,n.__)("Medium size","bubuku-media-library"),count:null!=t?t:0,variant:"medium"},{key:"bad",label:(0,n.__)("Large size","bubuku-media-library"),count:null!=a?a:0,variant:"bad"}];return(0,r.createElement)("div",{className:"bbk-size-summary"},(0,r.createElement)("div",{className:"bbk-size-tiles"},u.map(e=>(0,r.createElement)("div",{key:e.key,className:`bbk-size-tile bbk-size-tile--${e.variant}`},(0,r.createElement)("div",{className:"bbk-size-tile__number"},e.count),(0,r.createElement)("div",{className:"bbk-size-tile__label"},e.label)))),(0,r.createElement)("div",{className:"bbk-size-bar"},(0,r.createElement)("div",{className:"bbk-size-bar__track"},o>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"bbk-size-bar__segment bbk-size-bar__segment--good",style:{flex:i}}),(0,r.createElement)("div",{className:"bbk-size-bar__segment bbk-size-bar__segment--medium",style:{flex:l}}),(0,r.createElement)("div",{className:"bbk-size-bar__segment bbk-size-bar__segment--bad",style:{flex:s}}))),(0,r.createElement)("div",{className:"bbk-size-bar__footer"},(0,r.createElement)("span",{className:"bbk-size-bar__total"},(0,n.__)("Total:","bubuku-media-library")," ",(0,r.createElement)("strong",null,o.toLocaleString())," ",(0,n.__)("images analyzed","bubuku-media-library")),s>0&&(0,r.createElement)("span",{className:"bbk-size-bar__attention"},c,"% ",(0,n.__)("require attention","bubuku-media-library")))))},_=2*Math.PI*45,f=e=>parseInt(String(e).replace(/\D/g,""),10)||0,g=({altEmpty:e,total:t,withoutAlt:a,withAlt:i})=>{const l=f(null!=a?a:e),s=f(t),o=f(i),c=s>0?Math.min(l,s):l,u=o>0?o:Math.max(s-c,0),m=s>0?Math.min(l,s):0,d=s>0?Math.round(m/s*100):0,b=_*(1-d/100),h=(e=>e<10?"var(--success)":e<30?"var(--warning)":"var(--danger)")(d);return(0,r.createElement)("div",{className:"bbk-summary-alt-chart"},(0,r.createElement)("svg",{className:"bbk-summary-alt-chart__donut",width:"100",height:"100",viewBox:"0 0 100 100","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"50",cy:"50",r:45,fill:"none",stroke:"var(--border)",strokeWidth:"10"}),(0,r.createElement)("circle",{cx:"50",cy:"50",r:45,fill:"none",stroke:h,strokeWidth:"10",strokeDasharray:_,strokeDashoffset:b,strokeLinecap:"round",transform:"rotate(-90 50 50)"}),(0,r.createElement)("text",{x:"50",y:"46",textAnchor:"middle",dominantBaseline:"middle",fontSize:"16",fontWeight:"700",fill:h},d,"%"),(0,r.createElement)("text",{x:"50",y:"62",textAnchor:"middle",dominantBaseline:"middle",fontSize:"9",fill:"var(--bk-text-secondary)"},(0,n.__)("missing","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-summary-alt-chart__legend"},(0,r.createElement)("div",{className:"bbk-summary-alt-chart__legend-item"},(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-dot bbk-summary-alt-chart__legend-dot--missing"}),(0,n.__)("Without ALT","bubuku-media-library"),(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-value"},l.toLocaleString())),(0,r.createElement)("div",{className:"bbk-summary-alt-chart__legend-item"},(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-dot bbk-summary-alt-chart__legend-dot--present"}),(0,n.__)("With ALT","bubuku-media-library"),(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-value"},u.toLocaleString()))))},y=e=>parseInt(String(e).replace(/\D/g,""),10)||0,E=()=>(0,r.createElement)("div",{className:"bbk-summary-skeleton"},(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--full"}),(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--medium"}),(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--full"}),(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--short"})),v=()=>{const[e,t]=(0,i.useState)(""),[a,l]=(0,i.useState)(!1),[o,c]=(0,i.useState)(!0),[u,m]=(0,i.useState)(null),[d,b]=(0,i.useState)(!0),p=BbkMediaLibrary.api_url.endsWith("/")?BbkMediaLibrary.api_url.slice(0,-1):BbkMediaLibrary.api_url,_=`${p}/get-notification-settings`,f=`${p}/get-summary-stats`,v=BbkMediaLibrary._wpnonce;(0,i.useEffect)(()=>{fetch(_,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(e=>{t(e.data.emails),l(e.data.disabled),c(!1)})},[_,v]),(0,i.useEffect)(()=>{fetch(f,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(e=>{m(e),b(!1)}).catch(()=>{b(!1)})},[f]);let w=0;return u?.totals?.images_total?w=y(u.totals.images_total):u?.img_sizes&&(w=y(u.img_sizes.good)+y(u.img_sizes.medium)+y(u.img_sizes.bad)),(0,r.createElement)("div",{className:"bbk-dashboard"},(0,r.createElement)("div",{className:"bbk-summary-grid"},(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,r.createElement)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,r.createElement)("polyline",{points:"21 15 16 10 5 21"})),iconVariant:"icon-accent",title:(0,n.__)("Image Size","bubuku-media-library"),claim:(0,n.__)("Distribution by weight quality","bubuku-media-library"),animationDelay:".05s"},d?(0,r.createElement)(E,null):(0,r.createElement)(k,{good:u?.img_sizes?.good,medium:u?.img_sizes?.medium,bad:u?.img_sizes?.bad})),(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},(0,r.createElement)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,r.createElement)("circle",{cx:"12",cy:"12",r:"3"})),title:(0,n.__)("ALT Accessibility","bubuku-media-library"),claim:(0,n.__)("Images without alternative text","bubuku-media-library"),animationDelay:".1s"},d?(0,r.createElement)(E,null):(0,r.createElement)(g,{altEmpty:u?.img_alt_empty,total:w,withoutAlt:u?.totals?.without_alt,withAlt:u?.totals?.with_alt}))),!o&&(0,r.createElement)(h,{reportsEmails:e,reportsDisable:a}))},w=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"7 10 12 15 17 10"}),(0,r.createElement)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})),N=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),x=()=>{const[e,t]=(0,i.useState)("all"),[a,l]=(0,i.useState)("all"),[s,o]=(0,i.useState)(!1),[c,u]=(0,i.useState)(!1);let m=null;return m=c?(0,n.__)("Exporting…","bubuku-media-library"):s?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(N,null),(0,n.__)("Downloaded!","bubuku-media-library")):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(w,null),(0,n.__)("Export CSV","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-export-form"},(0,r.createElement)("div",{className:"bk-filters-grid"},(0,r.createElement)("div",{className:"bk-filter-group"},(0,r.createElement)("span",{className:"bk-filter-label"},(0,n.__)("Filter by ALT text","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-chip-group",role:"group","aria-label":(0,n.__)("Filter by ALT text","bubuku-media-library")},(0,r.createElement)("button",{type:"button",className:"bk-chip"+("all"===e?" bk-chip--active":""),onClick:()=>t("all"),"aria-pressed":"all"===e},(0,n.__)("All","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip"+("none"===e?" bk-chip--active":""),onClick:()=>t("none"),"aria-pressed":"none"===e},(0,n.__)("Without ALT","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip"+("some"===e?" bk-chip--active":""),onClick:()=>t("some"),"aria-pressed":"some"===e},(0,n.__)("With ALT","bubuku-media-library")))),(0,r.createElement)("div",{className:"bk-filter-group"},(0,r.createElement)("span",{className:"bk-filter-label"},(0,n.__)("Filter by size","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-chip-group",role:"group","aria-label":(0,n.__)("Filter by size","bubuku-media-library")},(0,r.createElement)("button",{type:"button",className:"bk-chip"+("all"===a?" bk-chip--active":""),onClick:()=>l("all"),"aria-pressed":"all"===a},(0,n.__)("All","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip bk-chip--good"+("good"===a?" bk-chip--active":""),onClick:()=>l("good"),"aria-pressed":"good"===a},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--good","aria-hidden":"true"}),(0,n.__)("Good","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip bk-chip--mid"+("mid"===a?" bk-chip--active":""),onClick:()=>l("mid"),"aria-pressed":"mid"===a},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--mid","aria-hidden":"true"}),(0,n.__)("Medium","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip bk-chip--bad"+("bad"===a?" bk-chip--active":""),onClick:()=>l("bad"),"aria-pressed":"bad"===a},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--bad","aria-hidden":"true"}),(0,n.__)("Bad","bubuku-media-library"))))),(0,r.createElement)("div",{className:"bk-size-legend"},(0,r.createElement)("div",{className:"bk-size-legend__item"},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--good","aria-hidden":"true"}),(0,r.createElement)("strong",{className:"bk-size-legend__label bk-size-legend__label--good"},(0,n.__)("Good","bubuku-media-library")),"< 100 KB"),(0,r.createElement)("div",{className:"bk-size-legend__item"},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--mid","aria-hidden":"true"}),(0,r.createElement)("strong",{className:"bk-size-legend__label bk-size-legend__label--mid"},(0,n.__)("Medium","bubuku-media-library")),"100–500 KB"),(0,r.createElement)("div",{className:"bk-size-legend__item"},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--bad","aria-hidden":"true"}),(0,r.createElement)("strong",{className:"bk-size-legend__label bk-size-legend__label--bad"},(0,n.__)("Bad","bubuku-media-library")),"> 500 KB")),(0,r.createElement)("div",{className:"bk-card-footer"},(0,r.createElement)("p",{className:"bk-card-footer__info bk-export-count"},(0,n.__)("Exporting","bubuku-media-library")," ",(0,r.createElement)("strong",null,(()=>{if("all"===e&&"all"===a)return(0,n.__)("all files","bubuku-media-library");const t=[];if("all"!==e&&t.push("none"===e?(0,n.__)("without ALT","bubuku-media-library"):(0,n.__)("with ALT","bubuku-media-library")),"all"!==a){const e={good:(0,n.__)("Good (< 100 KB)","bubuku-media-library"),mid:(0,n.__)("Medium (100–500 KB)","bubuku-media-library"),bad:(0,n.__)("Bad (> 500 KB)","bubuku-media-library")};t.push(e[a])}return t.join(", ")})())),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-primary",onClick:async()=>{u(!0);try{var t;const r=new URLSearchParams({alt_filter:e,size_filter:a}),i=await fetch(`${BbkMediaLibrary.api_url}/export-csv?${r}`,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}});if(!i.ok)throw new Error(`Error ${i.status}: ${i.statusText}`);const n=(null!==(t=i.headers.get("Content-Disposition"))&&void 0!==t?t:"").match(/filename="([^"]+)"/),l=n?n[1]:`media-library-export-${(new Date).toISOString().slice(0,10)}.csv`,s=await i.blob(),c=URL.createObjectURL(s),u=Object.assign(document.createElement("a"),{href:c,download:l});document.body.appendChild(u),u.click(),u.remove(),URL.revokeObjectURL(c),o(!0),setTimeout(()=>o(!1),3e3)}catch(e){console.error("CSV export failed:",e)}finally{u(!1)}},disabled:c},m)))};var C=a(809),S=a.n(C);const L=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),z=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.createElement)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),M=()=>{const[e,t]=(0,i.useState)(null),[a,l]=(0,i.useState)(!1),[s,o]=(0,i.useState)(0),[c,u]=(0,i.useState)(""),[m,d]=(0,i.useState)(""),[b,h]=(0,i.useState)(!1),p=(0,i.useRef)(null),k=`${BbkMediaLibrary.api_url}/import-alt-chunk`,_=BbkMediaLibrary.rest_nonce,f=["ID","Alt Text"],g=e=>{var t;return(null!==(t=e?.name)&&void 0!==t?t:"").toLowerCase().endsWith(".csv")},y=()=>{p.current&&p.current.click()};return(0,r.createElement)("form",{id:"bbk-import-alt-form",onSubmit:a=>{a.preventDefault(),e?(l(!0),o(0),u(""),d(""),S().parse(e,{header:!0,skipEmptyLines:!0,complete:async e=>{const a=e.data;if(0===a.length)return l(!1),void d((0,n.__)("The CSV file is empty.","bubuku-media-library"));const r=e.meta.fields||[],i=f.filter(e=>!r.includes(e));if(i.length>0)return l(!1),void d((0,n.sprintf)(/* translators: %s: comma-separated list of missing column names */ /* translators: %s: comma-separated list of missing column names */ 2 (0,n.__)("Invalid CSV structure. Missing required columns: %s","bubuku-media-library"),i.join(", ")));const s=Math.ceil(a.length/100);let c=0,m=[];for(let e=0;e<s;e++){const t=a.slice(100*e,100*(e+1));try{const e=await fetch(k,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":_},body:JSON.stringify({rows:t})}),a=await e.json();if(!e.ok||!a.success)throw new Error(a?.message||(0,n.__)("Failed to process chunk.","bubuku-media-library"));c+=a.data.updated||0,a.data.errors&&a.data.errors.length>0&&(m=m.concat(a.data.errors))}catch(t){console.error(`Chunk ${e+1} failed:`,t),m.push((0,n.sprintf)(/* translators: %d: chunk number */ /* translators: %d: chunk number */ 3 (0,n.__)("Chunk %d failed to process.","bubuku-media-library"),e+1))}o(Math.round((e+1)/s*100))}l(!1),o(100),m.length>0?d((0,n.sprintf)(/* translators: %1$d: processed rows, %2$d: total errors */ /* translators: %1$d: processed rows, %2$d: total errors */ 4 (0,n.__)("Import completed with errors. Processed: %1$d — Errors: %2$d","bubuku-media-library"),c,m.length)):u((0,n.sprintf)(/* translators: %d: number of updated images */ /* translators: %d: number of updated images */ 5 (0,n.__)("Import complete. Updated: %d","bubuku-media-library"),c)),t(null),p.current&&(p.current.value="")},error:e=>{l(!1),d((0,n.sprintf)(/* translators: %s: error message */ /* translators: %s: error message */ 6 (0,n.__)("Failed to parse CSV: %s","bubuku-media-library"),e.message))}})):d((0,n.__)("Please select a CSV file.","bubuku-media-library"))}},(0,r.createElement)("div",{className:"upload-zone"+(b?" upload-zone--dragging":""),id:"import-zone",onClick:y,onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.preventDefault(),h(!1)},onDrop:e=>{e.preventDefault(),h(!1);const a=e.dataTransfer.files[0]||null;if(a){if(!g(a))return void d((0,n.__)("Only .CSV files are accepted.","bubuku-media-library"));t(a),u(""),d("")}},onKeyDown:e=>"Enter"===e.key&&y(),role:"button",tabIndex:0,"aria-label":(0,n.__)("Click to select or drag a CSV file here","bubuku-media-library")},(0,r.createElement)("input",{ref:p,type:"file",id:"import-file",name:"csv_file",accept:".csv",onChange:e=>{const a=e.target.files[0]||null;if(a&&!g(a))return d((0,n.__)("Only .CSV files are accepted.","bubuku-media-library")),void(e.target.value="");t(a),u(""),d("")},disabled:a,style:{display:"none"}}),(0,r.createElement)("div",{className:"upload-zone-icon"},(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.createElement)("polyline",{points:"14 2 14 8 20 8"}),(0,r.createElement)("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),(0,r.createElement)("line",{x1:"9",y1:"15",x2:"15",y2:"15"}))),(0,r.createElement)("p",null,(0,r.createElement)("strong",null,(0,n.__)("Click to select","bubuku-media-library"))," ",(0,n.__)("or drag your file here","bubuku-media-library")),(0,r.createElement)("p",{className:"upload-hint"},(0,n.__)("Only .CSV files","bubuku-media-library"))),(0,r.createElement)("div",{className:"bk-card-footer"},(e||a&&s>0||c||m)&&(0,r.createElement)("div",{className:"bk-card-footer__info"},e&&(0,r.createElement)("div",{className:"file-selected",id:"import-selected"},(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),(0,r.createElement)("span",null,(0,n.__)("Selected file:","bubuku-media-library")," ",(0,r.createElement)("span",{className:"file-name"},e.name))),a&&s>0&&(0,r.createElement)("div",{className:"bk-progress-bar"},(0,r.createElement)("div",{className:"bk-progress-bar__track"},(0,r.createElement)("div",{className:"bk-progress-bar__fill",style:{width:`${s}%`}})),(0,r.createElement)("span",{className:"bk-progress-bar__label"},(0,n.sprintf)(/* translators: %1$d: progress percentage */ /* translators: %1$d: progress percentage */ 7 (0,n.__)("Processing… %1$d%%","bubuku-media-library"),s))),c&&(0,r.createElement)("p",{className:"bbk-notice bbk-notice--success"},(0,r.createElement)(L,null),c),m&&(0,r.createElement)("p",{className:"bbk-notice bbk-notice--error"},(0,r.createElement)(z,null),m)),(0,r.createElement)("button",{type:"submit",className:"bk-btn bk-btn-primary",id:"import-btn",disabled:a||!e},(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"17 8 12 3 7 8"}),(0,r.createElement)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),a?(0,n.__)("Importing…","bubuku-media-library"):(0,n.__)("Import ALT text","bubuku-media-library"))))},O=()=>(0,r.createElement)("div",{className:"bbk-dashboard"},(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"7 10 12 15 17 10"}),(0,r.createElement)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})),title:(0,n.__)("Export ALT text to CSV","bubuku-media-library"),claim:(0,n.__)("Download a CSV with image data filtered by your selection","bubuku-media-library"),animationDelay:".05s"},(0,r.createElement)(x,null)),(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"17 8 12 3 7 8"}),(0,r.createElement)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),title:(0,n.__)("Import ALT text from CSV","bubuku-media-library"),claim:(0,n.__)("Upload the exported CSV file to update the ALT text of the images","bubuku-media-library"),animationDelay:".1s"},(0,r.createElement)(M,null))),B='This image file size is too large to upload. To reduce the file size, go to: <a href="https://squoosh.app/" target="_blank" rel="noopener noreferrer">https://squoosh.app/</a> , upload your image and on the controls select <strong>AVIF</strong> under the heading Compress, and set the quality to 80 or above. Download, and upload this new file.',A={enabled:!1,max_size_mb:1,message:B,image_id:0,image_url:"",image_alt:""},R=e=>{if(!e||!e.success||!e.data)return null;const t=e.data;return{enabled:Boolean(t.enabled),max_size_mb:Number(t.max_size_mb)||A.max_size_mb,message:"string"==typeof t.message&&""!==t.message?t.message:B,image_id:Number(t.image_id)||0,image_url:"string"==typeof t.image_url?t.image_url:"",image_alt:"string"==typeof t.image_alt?t.image_alt:""}},T=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"17 8 12 3 7 8"}),(0,r.createElement)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),j=()=>{const[e,t]=(0,i.useState)(!0),[a,l]=(0,i.useState)(!1),[o,c]=(0,i.useState)(""),[u,m]=(0,i.useState)(""),[d,b]=(0,i.useState)(A),h=(0,i.useRef)(null),p=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/get-upload-limit-settings`,[]),k=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/set-upload-limit-settings`,[]);(0,i.useEffect)(()=>{fetch(p,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(e=>{const a=R(e);a&&b(a),t(!1)}).catch(()=>{c((0,n.__)("Could not load upload limit settings. Please refresh and try again.","bubuku-media-library")),t(!1)})},[p]);const _=(e,t)=>{b(a=>({...a,[e]:t}))},f=!d.enabled;return(0,r.createElement)(s,{title:(0,n.__)("Upload size limit","bubuku-media-library"),claim:(0,n.__)("Block images above a configurable size before they reach the library.","bubuku-media-library"),icon:(0,r.createElement)(T,null),animationDelay:".08s"},(0,r.createElement)("div",{className:"bbk-upload-limit-card"},e&&(0,r.createElement)("p",{className:"bbk-tools-placeholder"},(0,n.__)("Loading upload limit settings…","bubuku-media-library")),!e&&o&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--error"},o),!e&&u&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--success"},u),!e&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"bbk-upload-limit-layout"},(0,r.createElement)("div",{className:"bbk-upload-limit-row bbk-upload-limit-row--toggle"},(0,r.createElement)("label",{className:"bbk-tools-toggle",htmlFor:"bbk-upload-limit-enabled","aria-label":(0,n.__)("Enable upload size limit","bubuku-media-library")},(0,r.createElement)("input",{id:"bbk-upload-limit-enabled",type:"checkbox",checked:d.enabled,onChange:e=>_("enabled",e.target.checked)})),(0,r.createElement)("div",{className:"bbk-upload-limit-row-text"},(0,r.createElement)("strong",null,(0,n.__)("Block oversized image uploads","bubuku-media-library")),(0,r.createElement)("p",null,(0,n.__)("Applies to every role, administrators included. Only image files are affected.","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--size"},(0,r.createElement)("label",{htmlFor:"bbk-upload-limit-max-size"},(0,n.__)("Maximum size","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-max-size-input"},(0,r.createElement)("input",{id:"bbk-upload-limit-max-size",type:"number",step:"0.1",min:"0.1",max:"64",disabled:f,value:d.max_size_mb,onChange:e=>_("max_size_mb",""===e.target.value?"":Number(e.target.value))}),(0,r.createElement)("span",null,(0,n.__)("MB","bubuku-media-library"))),(0,r.createElement)("p",{className:"bbk-upload-limit-hint"},(0,n.__)("Only applies to image files (image/*).","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--message"},(0,r.createElement)("div",{className:"bbk-upload-limit-field-header"},(0,r.createElement)("label",{htmlFor:"bbk-upload-limit-message"},(0,n.__)("Message shown to editors","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",disabled:f,onClick:()=>{_("message",B)}},(0,n.__)("Restore default message","bubuku-media-library"))),(0,r.createElement)("textarea",{id:"bbk-upload-limit-message",rows:"8",className:"bbk-upload-limit-message-input",disabled:f,value:d.message,onChange:e=>_("message",e.target.value)}),(0,r.createElement)("p",{className:"bbk-upload-limit-hint"},(0,n.__)("Allowed tags: a, strong, b, em, i, br, p, ul, ol, li, code, span.","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--image"},(0,r.createElement)("span",{className:"bbk-upload-limit-field-label"},(0,n.__)("Supporting image","bubuku-media-library")),d.image_url?(0,r.createElement)("div",{className:"bbk-upload-limit-image-preview"},(0,r.createElement)("img",{src:d.image_url,alt:d.image_alt})):(0,r.createElement)("p",{className:"bbk-upload-limit-hint"},(0,n.__)("No image selected.","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-image-actions"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",disabled:f,onClick:()=>{"undefined"!=typeof wp&&wp.media&&(h.current||(h.current=wp.media({title:(0,n.__)("Select an image","bubuku-media-library"),library:{type:"image"},multiple:!1}),h.current.on("select",()=>{const e=h.current.state().get("selection"),t=e?e.first():null;if(!t)return;const a=t.toJSON();b(e=>({...e,image_id:a.id,image_url:a.sizes?.large?.url||a.url,image_alt:a.alt||""}))})),h.current.open())}},d.image_url?(0,n.__)("Replace image","bubuku-media-library"):(0,n.__)("Select image","bubuku-media-library")),d.image_url&&(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",disabled:f,onClick:()=>{b(e=>({...e,image_id:0,image_url:"",image_alt:""}))}},(0,n.__)("Remove","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--preview"},(0,r.createElement)("span",{className:"bbk-upload-limit-field-label"},(0,n.__)("Preview","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-mock-overlay","aria-hidden":"true"},(0,r.createElement)("div",{className:"bbk-upload-limit-mock-dialog"},(0,r.createElement)("span",{className:"bbk-upload-limit-mock-close"},"×"),(0,r.createElement)("h3",{className:"bbk-upload-limit-mock-title"},(0,n.__)("Image too large","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-mock-body",dangerouslySetInnerHTML:{__html:d.message}}),(0,r.createElement)("ul",{className:"bbk-upload-limit-mock-files"},(0,r.createElement)("li",null,"example-photo.jpg"," ",(0,r.createElement)("span",{className:"bbk-upload-limit-mock-file-size"},"(2.4 MB)"))),d.image_url&&(0,r.createElement)("img",{className:"bbk-upload-limit-mock-image",src:d.image_url,alt:""}))))),(0,r.createElement)("div",{className:"bbk-tools-actions"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-primary",onClick:()=>{l(!0),c(""),m(""),fetch(k,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":BbkMediaLibrary.rest_nonce},body:JSON.stringify({enabled:d.enabled,max_size_mb:""===d.max_size_mb?0:Number(d.max_size_mb),message:d.message,image_id:d.image_id})}).then(e=>e.json()).then(e=>{if(l(!1),!e||!e.success)return void c((0,n.__)("Could not save upload limit settings. Please try again.","bubuku-media-library"));const t=R(e);t&&b(t),m((0,n.__)("Upload limit settings saved.","bubuku-media-library"))}).catch(()=>{l(!1),c((0,n.__)("A network error occurred while saving. Please try again.","bubuku-media-library"))})},disabled:a},a?(0,n.__)("Saving…","bubuku-media-library"):(0,n.__)("Save upload limit settings","bubuku-media-library"))))))},W=()=>(0,r.createElement)("div",{className:"bbk-dashboard"},(0,r.createElement)(j,null)),P=(document.documentElement.lang||"en").toLowerCase();function D(e,t){const a=new URLSearchParams({utm_source:"bml-plugin",utm_medium:"wp-admin-footer",utm_campaign:"bml-plugin-footer-links",utm_content:t+"-"+P});return e+(e.includes("?")?"&":"?")+a.toString()}const I=[{href:D("https://www.bubuku.com/blog/anadir-texto-alternativo-wordpress/","article-add-alt-text"),label:(0,n.__)("How to add alternative text to images in WordPress for better SEO and accessibility","bubuku-media-library")},{href:D("https://www.bubuku.com/blog/alt-text-wpml-csv/","article-alt-text-csv-wpml"),label:(0,n.__)("How to export and import alternative text in WordPress with WPML and CSV files","bubuku-media-library")},{href:D("https://www.bubuku.com/blog/cambiar-imagenes-wordpress/","article-update-images"),label:(0,n.__)("How to change or update images in WordPress without impacting performance","bubuku-media-library")},{href:D("https://www.bubuku.com/blog/solucion-sizes-auto-wordpress/","article-sizes-auto"),label:(0,n.__)('How to solve problems with the sizes="auto" attribute in WordPress',"bubuku-media-library")},{href:D("https://www.bubuku.com/blog/optimizacion-carga-imagenes-wordpress/","article-optimize-image-loading"),label:(0,n.__)("How to optimize image loading in WordPress for better performance and Core Web Vitals","bubuku-media-library")}],F=[{label:(0,n.__)("Business-driven custom WordPress development","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"}))},{label:(0,n.__)("Plugins and external systems integrations","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),(0,r.createElement)("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"}))},{label:(0,n.__)("Continuous maintenance and support","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"23 4 23 10 17 10"}),(0,r.createElement)("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"}))},{label:(0,n.__)("Performance and conversion rate optimization","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),(0,r.createElement)("polyline",{points:"17 6 23 6 23 12"}))},{label:(0,n.__)("Technical implementation and integrations","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"12",cy:"12",r:"3"}),(0,r.createElement)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"}))}];function U(){return(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.createElement)("polyline",{points:"14 2 14 8 20 8"}),(0,r.createElement)("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),(0,r.createElement)("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),(0,r.createElement)("polyline",{points:"10 9 9 9 8 9"}))}function $(){return(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"}))}function H(){return(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,r.createElement)("polyline",{points:"12 5 19 12 12 19"}))}const q=D("https://www.bubuku.com/servicios/","cta-services"),V=function(){return(0,r.createElement)("footer",{className:"bk-footer-main"},(0,r.createElement)("div",{className:"bk-footer-main__inner"},(0,r.createElement)("div",{className:"bk-footer-main__resources"},(0,r.createElement)("div",{className:"bk-footer-main__section-title"},(0,r.createElement)("div",{className:"bk-footer-main__icon"},(0,r.createElement)(U,null)),(0,r.createElement)("p",{className:"bk-footer-main__heading"},(0,n.__)("Useful resources on image optimization (Spanish guides)","bubuku-media-library"))),(0,r.createElement)("p",{className:"bk-footer-main__description"},(0,n.__)("We've compiled some practical articles that can help you improve image loading and management in WordPress.","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-footer-main__divider"}),(0,r.createElement)("ul",{className:"bk-footer-main__links"},I.map((e,t)=>(0,r.createElement)("li",{key:t},(0,r.createElement)(U,null),(0,r.createElement)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer"},e.label))))),(0,r.createElement)("div",{className:"bk-footer-main__team"},(0,r.createElement)("div",{className:"bk-footer-main__team-title"},(0,r.createElement)("div",{className:"bk-footer-main__icon"},(0,r.createElement)($,null)),(0,r.createElement)("p",{className:"bk-footer-main__team-heading"},(0,n.__)("Technical partner for your WordPress projects","bubuku-media-library"))),(0,r.createElement)("p",{className:"bk-footer-main__team-description"},(0,n.__)("We work alongside marketing and business teams to improve the stability, performance, and evolution of your WordPress projects.","bubuku-media-library")),(0,r.createElement)("ul",{className:"bk-footer-main__services"},F.map((e,t)=>(0,r.createElement)("li",{key:t},e.icon,(0,r.createElement)("span",null,e.label)))),(0,r.createElement)("a",{href:q,target:"_blank",rel:"noopener noreferrer",className:"bk-footer-main__cta"},(0,n.__)("See how we work","bubuku-media-library"),(0,r.createElement)(H,null)))))},K=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,r.createElement)("path",{d:"M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4"}),(0,r.createElement)("path",{d:"M12 2v2"}),(0,r.createElement)("path",{d:"M9 12v9"}),(0,r.createElement)("path",{d:"M15 12v9"}),(0,r.createElement)("path",{d:"M5 16l4 -2"}),(0,r.createElement)("path",{d:"M15 14l4 2"}),(0,r.createElement)("path",{d:"M9 18h6"}),(0,r.createElement)("path",{d:"M10 8v.01"}),(0,r.createElement)("path",{d:"M14 8v.01"})),G=({animationDelay:e=".18s",showManageAction:t=!1,onManageTools:a=null})=>{const i=BbkMediaLibrary&&BbkMediaLibrary.mcp_server_url?String(BbkMediaLibrary.mcp_server_url):"",l=BbkMediaLibrary&&BbkMediaLibrary.profile_app_passwords_url?String(BbkMediaLibrary.profile_app_passwords_url):"/wp-admin/profile.php#application-passwords-section",o=i.trim().length>0,[c,u]=wp.element.useState(""),m=`{\n "mcpServers": {\n "bubuku-media-library": {\n "command": "npx",\n "args": [\n "-y",\n "mcp-remote",\n "${i}",\n "--header",\n "Authorization: Basic BASE64_OF_USER_AND_APP_PASSWORD"\n ]\n }\n }\n}`,d=async(e,t)=>{if(e)try{await navigator.clipboard.writeText(e),u(t),window.setTimeout(()=>{u(e=>e===t?"":e)},1800)}catch(e){u("")}},b=(0,r.createElement)("span",{className:"bbk-mcp-header-status "+(o?"is-active":"is-inactive")},o?(0,n.__)("Active","bubuku-media-library"):(0,n.__)("Inactive","bubuku-media-library"));return(0,r.createElement)(s,{icon:(0,r.createElement)(K,null),title:(0,n.__)("MCP Server","bubuku-media-library"),claim:(0,n.__)("Expose plugin abilities through one MCP server URL","bubuku-media-library"),headerMeta:b,animationDelay:e},(0,r.createElement)("div",{className:"bbk-agent-api-card"},(0,r.createElement)("div",{className:"bbk-mcp-url-block"},(0,r.createElement)("div",{className:"bbk-mcp-url-row"},(0,r.createElement)("span",{className:"bbk-mcp-url-value"},i||(0,n.__)("Unavailable","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>d(i,"server-url"),disabled:!i},"server-url"===c?(0,n.__)("Copied","bubuku-media-library"):(0,n.__)("Copy","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-mcp-divider","aria-hidden":"true"}),(0,r.createElement)("details",{className:"bbk-mcp-summary"},(0,r.createElement)("summary",null,(0,r.createElement)("span",{className:"bbk-mcp-summary-chevron","aria-hidden":"true"},(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},(0,r.createElement)("polyline",{points:"9 18 15 12 9 6"}))),(0,n.__)("Configure in Claude Desktop","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-mcp-summary__content"},(0,r.createElement)("ol",{className:"bbk-mcp-steps"},(0,r.createElement)("li",null,(0,r.createElement)("strong",null,(0,n.__)("Get your application password","bubuku-media-library")),(0,r.createElement)("span",null,(0,n.__)("Go to","bubuku-media-library")," ",(0,r.createElement)("a",{href:l,target:"_blank",rel:"noopener noreferrer"},(0,n.__)("Profile -> Application Passwords","bubuku-media-library"))," ",(0,n.__)("and create one for your WordPress user.","bubuku-media-library"))),(0,r.createElement)("li",null,(0,r.createElement)("strong",null,(0,n.__)("Encode credentials","bubuku-media-library")),(0,r.createElement)("span",null,(0,n.__)("Base64-encode","bubuku-media-library")," ",(0,r.createElement)("code",null,"username:app_password")," ",(0,n.__)("and replace","bubuku-media-library")," ",(0,r.createElement)("code",null,"BASE64_OF_USER_AND_APP_PASSWORD"),".")),(0,r.createElement)("li",null,(0,r.createElement)("strong",null,(0,n.__)("Add to claude_desktop_config.json","bubuku-media-library")),(0,r.createElement)("span",null,(0,n.__)("Requires","bubuku-media-library")," ",(0,r.createElement)("a",{href:"https://nodejs.org/",target:"_blank",rel:"noopener noreferrer"},(0,n.__)("Node.js","bubuku-media-library"))," ",(0,n.__)("- Claude Desktop uses","bubuku-media-library")," ",(0,r.createElement)("code",null,"mcp-remote")," ",(0,n.__)("via","bubuku-media-library")," ",(0,r.createElement)("code",null,"npx")," ",(0,n.__)("as a stdio bridge.","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-mcp-code-block"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>d(m,"snippet")},"snippet"===c?(0,n.__)("Copied","bubuku-media-library"):(0,n.__)("Copy","bubuku-media-library")),(0,r.createElement)("pre",null,(0,r.createElement)("code",null,m))),(0,r.createElement)("div",{className:"bbk-email-hint bbk-mcp-info-box"},(0,r.createElement)("p",null,(0,n.__)("This URL will return a 401 error when opened in a browser — that's normal, as it requires authenticated credentials.","bubuku-media-library"))))),t&&(0,r.createElement)("p",{className:"bbk-agent-api-card__action"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary",onClick:()=>{"function"==typeof a&&a()}},(0,n.__)("Manage per-tool abilities","bubuku-media-library")))))},X={tools:[],roles:{}},J=e=>e&&e.success&&e.data?{tools:Array.isArray(e.data.tools)?e.data.tools:[],roles:e.data.roles&&"object"==typeof e.data.roles?e.data.roles:{}}:X,Z=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"9 18 15 12 9 6"})),Q=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"11",cy:"11",r:"8"}),(0,r.createElement)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),Y=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),ee=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.createElement)("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})),te=({onToolsLoaded:e=null})=>{const[t,a]=(0,i.useState)(!0),[l,o]=(0,i.useState)(!1),[c,u]=(0,i.useState)(""),[m,d]=(0,i.useState)(""),[b,h]=(0,i.useState)(X),[p,k]=(0,i.useState)(null),[_,f]=(0,i.useState)(""),g=(0,i.useMemo)(()=>{if(!_.trim())return b.tools;const e=_.toLowerCase();return b.tools.filter(t=>(t.label||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)||(t.description||"").toLowerCase().includes(e))},[b.tools,_]),y=(0,i.useMemo)(()=>b.tools.filter(e=>e?.setting?.enabled).length,[b.tools]),E=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/get-tools-settings`,[]),v=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/set-tools-settings`,[]);(0,i.useEffect)(()=>{fetch(E,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(t=>{const r=J(t);h(r),a(!1),e&&e(r.tools.length)}).catch(()=>{u((0,n.__)("Could not load tools settings. Please refresh and try again.","bubuku-media-library")),a(!1)})},[E]);const w=e=>k(t=>t===e?null:e);return(0,r.createElement)("div",{className:"bbk-tools-abilities-panel"},(0,r.createElement)(G,{animationDelay:".06s"}),(0,r.createElement)(s,{title:(0,n.__)("Per-tool permissions","bubuku-media-library"),claim:(0,n.__)("Enable each tool and define the minimum role required to execute it.","bubuku-media-library"),icon:(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M12 20h9"}),(0,r.createElement)("path",{d:"M12 4h9"}),(0,r.createElement)("path",{d:"M4 9h16"}),(0,r.createElement)("path",{d:"M4 15h16"}),(0,r.createElement)("path",{d:"M5 4v16"}))},t&&(0,r.createElement)("p",{className:"bbk-tools-placeholder"},(0,n.__)("Loading tools settings...","bubuku-media-library")),!t&&c&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--error"},c),!t&&m&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--success"},m),!t&&!c&&0===b.tools.length&&(0,r.createElement)("p",{className:"bbk-tools-placeholder"},(0,n.__)("No tools were discovered. Check your tools loader configuration.","bubuku-media-library")),!t&&b.tools.length>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"bbk-tools-toolbar"},(0,r.createElement)("div",{className:"bbk-tools-search-wrap"},(0,r.createElement)(Q,null),(0,r.createElement)("input",{type:"search",className:"bbk-tools-search",placeholder:(0,n.__)("Search tools by name or slug...","bubuku-media-library"),value:_,onChange:e=>f(e.target.value)})),(0,r.createElement)("div",{className:"bbk-tools-toolbar-actions"},(0,r.createElement)("span",{className:"bbk-tools-enabled-count"},y," ",(0,n.__)("of","bubuku-media-library")," ",b.tools.length," ",(0,n.__)("enabled","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>{h(e=>({...e,tools:e.tools.map(e=>({...e,setting:{...e.setting,enabled:!0}}))}))}},(0,r.createElement)(Y,null),(0,n.__)("Enable all","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>{h(e=>({...e,tools:e.tools.map(e=>({...e,setting:{...e.setting,enabled:!1}}))}))}},(0,r.createElement)(ee,null),(0,n.__)("Disable all","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-tools-table-wrap"},(0,r.createElement)("table",{className:"bbk-tools-table"},(0,r.createElement)("thead",null,(0,r.createElement)("tr",null,(0,r.createElement)("th",{className:"bbk-tools-col-expand"}),(0,r.createElement)("th",null,(0,n.__)("Tool","bubuku-media-library")),(0,r.createElement)("th",{className:"bbk-tools-col-help"},(0,n.__)("Help","bubuku-media-library")),(0,r.createElement)("th",{className:"bbk-tools-col-role"},(0,n.__)("Minimum role","bubuku-media-library")),(0,r.createElement)("th",{className:"bbk-tools-col-enabled"},(0,n.__)("Enabled","bubuku-media-library")))),(0,r.createElement)("tbody",null,0===g.length?(0,r.createElement)("tr",null,(0,r.createElement)("td",{colSpan:5,className:"bbk-tools-no-results"},(0,n.__)("No tools match your search.","bubuku-media-library"))):null,g.map(e=>{const t=Boolean(e?.setting?.enabled),a=p===e.name,i=e?.setting?.role||"editor",l=`tool-${String(e.name).replace(/[^a-zA-Z0-9_-]/g,"-")}`,s=e.help?.criteria||e.help?.examples?.length>0;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("tr",{key:e.name,className:t?"":"is-disabled"},(0,r.createElement)("td",{className:"bbk-tools-col-expand"},s&&(0,r.createElement)("button",{type:"button",className:"bbk-tools-expand-btn"+(a?" is-open":""),onClick:()=>w(e.name),"aria-label":a?(0,n.__)("Collapse","bubuku-media-library"):(0,n.__)("Expand","bubuku-media-library"),"aria-expanded":a},(0,r.createElement)(Z,null))),(0,r.createElement)("td",null,(0,r.createElement)("strong",null,e.label),e.description&&(0,r.createElement)("p",{className:"bbk-tools-info-desc"},e.description)),(0,r.createElement)("td",{className:"bbk-tools-col-help"},s&&(0,r.createElement)("button",{type:"button",className:"bbk-tools-help-btn"+(a?" is-active":""),onClick:()=>w(e.name),"aria-label":(0,n.__)("Help","bubuku-media-library")},"?")),(0,r.createElement)("td",{className:"bbk-tools-col-role"},(0,r.createElement)("select",{value:i,onChange:t=>{return a=e.name,r=t.target.value,void h(e=>({...e,tools:e.tools.map(e=>e.name===a?{...e,setting:{...e.setting,role:r}}:e)}));var a,r}},Object.entries(b.roles).map(([e,t])=>(0,r.createElement)("option",{key:e,value:e},t))),!1===e.meets_capability_floor&&(0,r.createElement)("p",{className:"bbk-tools-role-warning",title:(0,n.__)("This tool always requires a minimum WordPress capability at runtime, regardless of the role selected here. The saved role is not being changed automatically.","bubuku-media-library")},(0,n.__)("⚠ Below this tool's required capability — it will still enforce it.","bubuku-media-library"))),(0,r.createElement)("td",{className:"bbk-tools-col-enabled"},(0,r.createElement)("label",{className:"bbk-tools-toggle",htmlFor:l},(0,r.createElement)("input",{id:l,type:"checkbox",checked:t,onChange:t=>{return a=e.name,r=t.target.checked,void h(e=>({...e,tools:e.tools.map(e=>e.name===a?{...e,setting:{...e.setting,enabled:r}}:e)}));var a,r}})))),a&&(0,r.createElement)("tr",{key:`${e.name}-info`,className:"bbk-tools-info-row"},(0,r.createElement)("td",{colSpan:"5"},(0,r.createElement)("div",{className:"bbk-tools-info-panel"},(e.help?.criteria||e.help?.examples?.length>0)&&(0,r.createElement)("div",{className:"bbk-tools-info-layout"},e.help?.criteria&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"bbk-tools-info-label"},(0,n.__)("When to use","bubuku-media-library")),(0,r.createElement)("p",{className:"bbk-tools-info-criteria"},e.help.criteria)),e.help?.examples?.length>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"bbk-tools-info-label"},(0,n.__)("Example prompts","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-tools-examples-list"},e.help.examples.map((t,a)=>(0,r.createElement)("div",{key:`${e.name}-ex-${a}`,className:"bbk-tools-example"},t)))))))))}))))),!t&&b.tools.length>0&&(0,r.createElement)("div",{className:"bbk-tools-actions"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-primary",onClick:()=>{o(!0),u(""),d("");const e=b.tools.reduce((e,t)=>(e[t.name]={enabled:t.setting?.enabled?1:0,role:t.setting?.role||"editor"},e),{});fetch(v,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":BbkMediaLibrary.rest_nonce},body:JSON.stringify({settings:e})}).then(e=>e.json()).then(e=>{o(!1),e&&e.success?(h(J(e)),d(e?.data?.message||(0,n.__)("Tools settings saved.","bubuku-media-library"))):u((0,n.__)("Could not save tools settings. Please try again.","bubuku-media-library"))}).catch(()=>{o(!1),u((0,n.__)("A network error occurred while saving. Please try again.","bubuku-media-library"))})},disabled:l},l?(0,n.__)("Saving...","bubuku-media-library"):(0,n.__)("Save tools settings","bubuku-media-library")))))},ae="overview",re="export-import",ie="settings",ne="tools-abilities",le=ae,se=[{id:ae,label:(0,n.__)("Overview","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))},{id:re,label:(0,n.__)("Export/Import","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5M16.5 3 21 7.5m0 0L16.5 12M21 7.5H7.5"}))},{id:ie,label:(0,n.__)("Settings","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 0 1 0 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.216.456a1.125 1.125 0 0 1-1.37-.49l-1.296-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 0 1 0-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.369-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281Z"}),(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))},{id:ne,label:(0,n.__)("Tools & Abilities","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","aria-hidden":"true"},(0,r.createElement)("path",{d:"M12 8V4H8"}),(0,r.createElement)("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),(0,r.createElement)("path",{d:"M2 14h2"}),(0,r.createElement)("path",{d:"M20 14h2"}),(0,r.createElement)("path",{d:"M15 13v2"}),(0,r.createElement)("path",{d:"M9 13v2"}))}],oe=()=>{const e=new URLSearchParams(window.location.search).get("tab");return se.some(t=>t.id===e)?e:le},ce=function(){const[e,t]=(0,i.useState)(()=>oe()),[a,s]=(0,i.useState)(0);(0,i.useEffect)(()=>{const e=()=>{t(oe())};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)}},[]);return(0,r.createElement)("div",{className:"bk-app"},(0,r.createElement)(l,null),(0,r.createElement)("div",{className:"bbk-admin-tabs",role:"tablist","aria-label":(0,n.__)("Bubuku Settings","bubuku-media-library")},se.map(({id:i,label:n,icon:l})=>(0,r.createElement)("button",{key:i,type:"button",role:"tab","aria-selected":e===i,className:"bbk-admin-tab "+(e===i?"is-active":""),onClick:()=>{return t(e=i),void(e=>{const t=new URL(window.location.href);e===le?t.searchParams.delete("tab"):t.searchParams.set("tab",e),window.history.replaceState({},"",`${t.pathname}${t.search}`)})(e);var e}},(0,r.createElement)(l,null),n,i===ne&&a>0&&(0,r.createElement)("span",{className:"bbk-admin-tab__badge"},a)))),(0,r.createElement)("div",{role:"tabpanel"},e===ae&&(0,r.createElement)(v,null),e===re&&(0,r.createElement)(O,null),e===ie&&(0,r.createElement)(W,null),e===ne&&(0,r.createElement)(te,{onToolsLoaded:s})),(0,r.createElement)(V,null))};document.addEventListener("DOMContentLoaded",function(){const e=document.getElementById("bbk-media-library-app");null!=e&&(0,i.createRoot)(e).render((0,r.createElement)(ce,null))})},901(){},809(e,t){var a,r;a=function e(){var t,a="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==a?a:{},r=!a.document&&!!a.postMessage,i=a.IS_PAPA_WORKER||!1,n={},l=0,s={};function o(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=g(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new b(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,t){var r=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<r){let t=this._config.newline;t||(n=this._config.quoteChar||'"',t=this._handle.guessLineEndings(e,n)),e=[...e.split(t).slice(r)].join(t)}this.isFirstChunk&&E(this._config.beforeFirstChunk)&&void 0!==(n=this._config.beforeFirstChunk(e))&&(e=n),this.isFirstChunk=!1,this._halted=!1,r=this._partialLine+e;var n=(this._partialLine="",this._handle.parse(r,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(e=n.meta.cursor,this._finished||(this._partialLine=r.substring(e-this._baseIndex),this._baseIndex=e),n&&n.data&&(this._rowCount+=n.data.length),r=this._finished||this._config.preview&&this._rowCount>=this._config.preview,i)a.postMessage({results:n,workerId:s.WORKER_ID,finished:r});else if(E(this._config.chunk)&&!t){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=n=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!r||!E(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),r||n&&n.meta.paused||this._nextChunk(),n}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):i&&this._config.error&&a.postMessage({workerId:s.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=s.RemoteChunkSize),o.call(this,e),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),r||(t.onload=y(this._chunkLoaded,this),t.onerror=y(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var e,a=this._config.downloadRequestHeaders;for(e in a)t.setRequestHeader(e,a[e])}var i;this._config.chunkSize&&(i=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+i));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}r&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(e=>null!==(e=e.getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1)(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(new Error(e))}}function u(e){(e=e||{}).chunkSize||(e.chunkSize=s.LocalChunkSize),o.call(this,e);var t,a,r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,a=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=y(this._chunkLoaded,this),t.onerror=y(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input,i=(this._config.chunkSize&&(i=Math.min(this._start+this._config.chunkSize,this._input.size),e=a.call(e,this._start,i)),t.readAsText(e,this._config.encoding));r||this._chunkLoaded({target:{result:i}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function m(e){var t;o.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,a;if(!this._finished)return e=this._config.chunkSize,t=e?(a=t.substring(0,e),t.substring(e)):(a=t,""),this._finished=!t,this.parseChunk(a)}}function d(e){o.call(this,e=e||{});var t=[],a=!0,r=!1;this.pause=function(){o.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){o.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):a=!0},this._streamData=y(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),a&&(a=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=y(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=y(function(){this._streamCleanUp(),r=!0,this._streamData("")},this),this._streamCleanUp=y(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function b(e){var t,a,r,i,n=Math.pow(2,53),l=-n,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,c=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,u=this,m=0,d=0,b=!1,k=!1,_=[],f={data:[],errors:[],meta:{}};function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function v(){if(f&&r&&(N("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(f.data=f.data.filter(function(e){return!y(e)})),w()){if(f)if(Array.isArray(f.data[0])){for(var t=0;w()&&t<f.data.length;t++)f.data[t].forEach(a);f.data.splice(0,1)}else f.data.forEach(a);function a(t,a){E(e.transformHeader)&&(t=e.transformHeader(t,a)),_.push(t)}}function i(t,a){for(var r=e.header?{}:[],i=0;i<t.length;i++){var s=i,u=t[i];u=((t,a)=>(t=>(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping)))(t)?"true"===a||"TRUE"===a||"false"!==a&&"FALSE"!==a&&((e=>{if(o.test(e)&&(e=parseFloat(e),l<e&&e<n))return 1})(a)?parseFloat(a):c.test(a)?new Date(a):""===a?null:a):a)(s=e.header?i>=_.length?"__parsed_extra":_[i]:s,u=e.transform?e.transform(u,s):u),"__parsed_extra"===s?(r[s]=r[s]||[],r[s].push(u)):r[s]=u}return e.header&&(i>_.length?N("FieldMismatch","TooManyFields","Too many fields: expected "+_.length+" fields but parsed "+i,d+a):i<_.length&&N("FieldMismatch","TooFewFields","Too few fields: expected "+_.length+" fields but parsed "+i,d+a)),r}var u;f&&(e.header||e.dynamicTyping||e.transform)&&(u=1,!f.data.length||Array.isArray(f.data[0])?(f.data=f.data.map(i),u=f.data.length):f.data=i(f.data,0),e.header&&f.meta&&(f.meta.fields=_),d+=u)}function w(){return e.header&&0===_.length}function N(e,t,a,r){e={type:e,code:t,message:a},void 0!==r&&(e.row=r),f.errors.push(e)}E(e.step)&&(i=e.step,e.step=function(t){f=t,w()?v():(v(),0!==f.data.length&&(m+=t.data.length,e.preview&&m>e.preview?a.abort():(f.data=f.data[0],i(f,u))))}),this.parse=function(i,n,l){var o=e.quoteChar||'"';return e.newline||(e.newline=this.guessLineEndings(i,o)),r=!1,e.delimiter?E(e.delimiter)&&(e.delimiter=e.delimiter(i),f.meta.delimiter=e.delimiter):((o=((t,a,r,i,n)=>{var l,o,c,u;n=n||[",","\t","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var m=0;m<n.length;m++){for(var d,b=n[m],h=0,k=0,_=0,f=(c=void 0,new p({comments:i,delimiter:b,newline:a,preview:10}).parse(t)),g=0;g<f.data.length;g++)r&&y(f.data[g])?_++:(k+=d=f.data[g].length,void 0===c?c=d:0<d&&(h+=Math.abs(d-c),c=d));0<f.data.length&&(k/=f.data.length-_),(void 0===o||h<=o)&&(void 0===u||u<k)&&1.99<k&&(o=h,l=b,u=k)}return{successful:!!(e.delimiter=l),bestDelimiter:l}})(i,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess)).successful?e.delimiter=o.bestDelimiter:(r=!0,e.delimiter=s.DefaultDelimiter),f.meta.delimiter=e.delimiter),o=g(e),e.preview&&e.header&&o.preview++,t=i,a=new p(o),f=a.parse(t,n,l),v(),b?{meta:{paused:!0}}:f||{meta:{paused:!1}}},this.paused=function(){return b},this.pause=function(){b=!0,a.abort(),t=E(e.chunk)?"":t.substring(a.getCharIndex())},this.resume=function(){u.streamer._halted?(b=!1,u.streamer.parseChunk(t,!0)):setTimeout(u.resume,3)},this.aborted=function(){return k},this.abort=function(){k=!0,a.abort(),f.meta.aborted=!0,E(e.complete)&&e.complete(f),t=""},this.guessLineEndings=function(e,t){e=e.substring(0,1048576),t=new RegExp(h(t)+"([^]*?)"+h(t),"gm");var a=(e=e.replace(t,"")).split("\r");if(e=1<(t=e.split("\n")).length&&t[0].length<a[0].length,1===a.length||e)return"\n";for(var r=0,i=0;i<a.length;i++)"\n"===a[i][0]&&r++;return r>=a.length/2?"\r\n":"\r"}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function p(e){var t=(e=e||{}).delimiter,a=e.newline,r=e.comments,i=e.step,n=e.preview,l=e.fastMode,o=null,c=!1,u=null==e.quoteChar?'"':e.quoteChar,m=u;if(void 0!==e.escapeChar&&(m=e.escapeChar),("string"!=typeof t||-1<s.BAD_DELIMITERS.indexOf(t))&&(t=","),r===t)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<s.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==a&&"\r"!==a&&"\r\n"!==a&&(a="\n");var d=0,b=!1;this.parse=function(s,p,k){if("string"!=typeof s)throw new Error("Input must be a string");var _=s.length,f=t.length,g=a.length,y=r.length,v=E(i),w=[],N=[],x=[],C=d=0;if(!s)return P();if(l||!1!==l&&-1===s.indexOf(u)){for(var S=s.split(a),L=0;L<S.length;L++){if(x=S[L],d+=x.length,L!==S.length-1)d+=a.length;else if(k)return P();if(!r||x.substring(0,y)!==r){if(v){if(w=[],R(x.split(t)),D(),b)return P()}else R(x.split(t));if(n&&n<=L)return w=w.slice(0,n),P(!0)}}return P()}for(var z=s.indexOf(t,d),M=s.indexOf(a,d),O=new RegExp(h(m)+h(u),"g"),B=s.indexOf(u,d);;)if(s[d]===u)for(B=d,d++;;){if(-1===(B=s.indexOf(u,B+1)))return k||N.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:w.length,index:d}),j();if(B===_-1)return j(s.substring(d,B).replace(O,u));if(u===m&&s[B+1]===m)B++;else if(u===m||0===B||s[B-1]!==m){-1!==z&&z<B+1&&(z=s.indexOf(t,B+1));var A=T(-1===(M=-1!==M&&M<B+1?s.indexOf(a,B+1):M)?z:Math.min(z,M));if(s.substr(B+1+A,f)===t){x.push(s.substring(d,B).replace(O,u)),s[d=B+1+A+f]!==u&&(B=s.indexOf(u,d)),z=s.indexOf(t,d),M=s.indexOf(a,d);break}if(A=T(M),s.substring(B+1+A,B+1+A+g)===a){if(x.push(s.substring(d,B).replace(O,u)),W(B+1+A+g),z=s.indexOf(t,d),B=s.indexOf(u,d),v&&(D(),b))return P();if(n&&w.length>=n)return P(!0);break}N.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:d}),B++}}else if(r&&0===x.length&&s.substring(d,d+y)===r){if(-1===M)return P();d=M+g,M=s.indexOf(a,d),z=s.indexOf(t,d)}else if(-1!==z&&(z<M||-1===M))x.push(s.substring(d,z)),d=z+f,z=s.indexOf(t,d);else{if(-1===M)break;if(x.push(s.substring(d,M)),W(M+g),v&&(D(),b))return P();if(n&&w.length>=n)return P(!0)}return j();function R(e){w.push(e),C=d}function T(e){return-1!==e&&(e=s.substring(B+1,e))&&""===e.trim()?e.length:0}function j(e){return k||(void 0===e&&(e=s.substring(d)),x.push(e),d=_,R(x),v&&D()),P()}function W(e){d=e,R(x),x=[],M=s.indexOf(a,d)}function P(r){if(e.header&&!p&&w.length&&!c){var i=w[0],n=Object.create(null),l=new Set(i);let t=!1;for(let a=0;a<i.length;a++){let r=i[a];if(n[r=E(e.transformHeader)?e.transformHeader(r,a):r]){let e,s=n[r];for(;e=r+"_"+s,s++,l.has(e););l.add(e),i[a]=e,n[r]++,t=!0,(o=null===o?{}:o)[e]=r}else n[r]=1,i[a]=r;l.add(r)}t&&console.warn("Duplicate headers found and renamed."),c=!0}return{data:w,errors:N,meta:{delimiter:t,linebreak:a,aborted:b,truncated:!!r,cursor:C+(p||0),renamedHeaders:o}}}function D(){i(P()),w=[],N=[]}},this.abort=function(){b=!0},this.getCharIndex=function(){return d}}function k(e){var t=e.data,a=n[t.workerId],r=!1;if(t.error)a.userError(t.error,t.file);else if(t.results&&t.results.data){var i={abort:function(){r=!0,_(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:f,resume:f};if(E(a.userStep)){for(var l=0;l<t.results.data.length&&(a.userStep({data:t.results.data[l],errors:t.results.errors,meta:t.results.meta},i),!r);l++);delete t.results}else E(a.userChunk)&&(a.userChunk(t.results,i,t.file),delete t.results)}t.finished&&!r&&_(t.workerId,t.results)}function _(e,t){var a=n[e];E(a.userComplete)&&a.userComplete(t),a.terminate(),delete n[e]}function f(){throw new Error("Not implemented.")}function g(e){if("object"!=typeof e||null===e)return e;var t,a=Array.isArray(e)?[]:{};for(t in e)a[t]=g(e[t]);return a}function y(e,t){return function(){e.apply(t,arguments)}}function E(e){return"function"==typeof e}return s.parse=function(t,r){var i=(r=r||{}).dynamicTyping||!1;if(E(i)&&(r.dynamicTypingFunction=i,i={}),r.dynamicTyping=i,r.transform=!!E(r.transform)&&r.transform,!r.worker||!s.WORKERS_SUPPORTED)return i=null,s.NODE_STREAM_INPUT,"string"==typeof t?(t=(e=>65279!==e.charCodeAt(0)?e:e.slice(1))(t),i=new(r.download?c:m)(r)):!0===t.readable&&E(t.read)&&E(t.on)?i=new d(r):(a.File&&t instanceof File||t instanceof Object)&&(i=new u(r)),i.stream(t);(i=(()=>{var t;return!!s.WORKERS_SUPPORTED&&(t=(()=>{var t=a.URL||a.webkitURL||null,r=e.toString();return s.BLOB_URL||(s.BLOB_URL=t.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",r,")();"],{type:"text/javascript"})))})(),(t=new a.Worker(t)).onmessage=k,t.id=l++,n[t.id]=t)})()).userStep=r.step,i.userChunk=r.chunk,i.userComplete=r.complete,i.userError=r.error,r.step=E(r.step),r.chunk=E(r.chunk),r.complete=E(r.complete),r.error=E(r.error),delete r.worker,i.postMessage({input:t,config:r,workerId:i.id})},s.unparse=function(e,t){var a=!1,r=!0,i=",",n="\r\n",l='"',o=l+l,c=!1,u=null,m=!1,d=((()=>{if("object"==typeof t){if("string"!=typeof t.delimiter||s.BAD_DELIMITERS.filter(function(e){return-1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),"boolean"!=typeof t.quotes&&"function"!=typeof t.quotes&&!Array.isArray(t.quotes)||(a=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(n=t.newline),"string"==typeof t.quoteChar&&(l=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");u=t.columns}void 0!==t.escapeChar&&(o=t.escapeChar+l),t.escapeFormulae instanceof RegExp?m=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(m=/^[=+\-@\t\r].*$/)}})(),new RegExp(h(l),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return b(null,e,c);if("object"==typeof e[0])return b(u||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||u),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),b(e.fields||[],e.data||[],c);throw new Error("Unable to serialize unrecognized input");function b(e,t,a){var l="",s=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0<e.length),o=!Array.isArray(t[0]);if(s&&r){for(var c=0;c<e.length;c++)0<c&&(l+=i),l+=p(e[c],c);0<t.length&&(l+=n)}for(var u=0;u<t.length;u++){var m=(s?e:t[u]).length,d=!1,b=s?0===Object.keys(t[u]).length:0===t[u].length;if(a&&!s&&(d="greedy"===a?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===a&&s){for(var h=[],k=0;k<m;k++){var _=o?e[k]:k;h.push(t[u][_])}d=""===h.join("").trim()}if(!d){for(var f=0;f<m;f++){0<f&&!b&&(l+=i);var g=s&&o?e[f]:f;l+=p(t[u][g],f)}u<t.length-1&&(!a||0<m&&!b)&&(l+=n)}}return l}function p(e,t){var r,n;return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(n=!1,m&&"string"==typeof e&&m.test(e)&&(e="'"+e,n=!0),r=e.toString().replace(d,o),(n=n||!0===a||"function"==typeof a&&a(e,t)||Array.isArray(a)&&a[t]||((e,t)=>{for(var a=0;a<t.length;a++)if(-1<e.indexOf(t[a]))return!0;return!1})(r,s.BAD_DELIMITERS)||-1<r.indexOf(i)||" "===r.charAt(0)||" "===r.charAt(r.length-1))?l+r+l:r)}},s.RECORD_SEP=String.fromCharCode(30),s.UNIT_SEP=String.fromCharCode(31),s.BYTE_ORDER_MARK="\ufeff",s.BAD_DELIMITERS=["\r","\n",'"',s.BYTE_ORDER_MARK],s.WORKERS_SUPPORTED=!r&&!!a.Worker,s.NODE_STREAM_INPUT=1,s.LocalChunkSize=10485760,s.RemoteChunkSize=5242880,s.DefaultDelimiter=",",s.Parser=p,s.ParserHandle=b,s.NetworkStreamer=c,s.FileStreamer=u,s.StringStreamer=m,s.ReadableStreamStreamer=d,a.jQuery&&((t=a.jQuery).fn.parse=function(e){var r=e.config||{},i=[];return this.each(function(e){if("INPUT"!==t(this).prop("tagName").toUpperCase()||"file"!==t(this).attr("type").toLowerCase()||!a.FileReader||!this.files||0===this.files.length)return!0;for(var n=0;n<this.files.length;n++)i.push({file:this.files[n],inputElem:this,instanceConfig:t.extend({},r)})}),n(),this;function n(){if(0===i.length)E(e.complete)&&e.complete();else{var a,r,n,o=i[0];if(E(e.before)){var c=e.before(o.file,o.inputElem);if("object"==typeof c){if("abort"===c.action)return a=o.file,r=o.inputElem,n=c.reason,void(E(e.error)&&e.error({name:"AbortError"},a,r,n));if("skip"===c.action)return void l();"object"==typeof c.config&&(o.instanceConfig=t.extend(o.instanceConfig,c.config))}else if("skip"===c)return void l()}var u=o.instanceConfig.complete;o.instanceConfig.complete=function(e){E(u)&&u(e,o.file,o.inputElem),l()},s.parse(o.file,o.instanceConfig)}}function l(){i.splice(0,1),n()}}),i&&(a.onmessage=function(e){e=e.data,void 0===s.WORKER_ID&&e&&(s.WORKER_ID=e.workerId),"string"==typeof e.input?a.postMessage({workerId:s.WORKER_ID,results:s.parse(e.input,e.config),finished:!0}):(a.File&&e.input instanceof File||e.input instanceof Object)&&(e=s.parse(e.input,e.config))&&a.postMessage({workerId:s.WORKER_ID,results:e,finished:!0})}),(c.prototype=Object.create(o.prototype)).constructor=c,(u.prototype=Object.create(o.prototype)).constructor=u,(m.prototype=Object.create(m.prototype)).constructor=m,(d.prototype=Object.create(o.prototype)).constructor=d,s},void 0===(r=a.apply(t,[]))||(e.exports=r)}},a={};function r(e){var i=a[e];if(void 0!==i)return i.exports;var n=a[e]={exports:{}};return t[e].call(n.exports,n,n.exports,r),n.exports}r.m=t,e=[],r.O=(t,a,i,n)=>{if(!a){var l=1/0;for(u=0;u<e.length;u++){for(var[a,i,n]=e[u],s=!0,o=0;o<a.length;o++)(!1&n||l>=n)&&Object.keys(r.O).every(e=>r.O[e](a[o]))?a.splice(o--,1):(s=!1,n<l&&(l=n));if(s){e.splice(u--,1);var c=i();void 0!==c&&(t=c)}}return t}n=n||0;for(var u=e.length;u>0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[a,i,n]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={884:0,15:0};r.O.j=t=>0===e[t];var t=(t,a)=>{var i,n,[l,s,o]=a,c=0;if(l.some(t=>0!==e[t])){for(i in s)r.o(s,i)&&(r.m[i]=s[i]);if(o)var u=o(r)}for(t&&t(a);c<l.length;c++)n=l[c],r.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return r.O(u)},a=globalThis.webpackChunkbubuku_media_library=globalThis.webpackChunkbubuku_media_library||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})(),r.O(void 0,[15],()=>r(980));var i=r.O(void 0,[15],()=>r(901));i=r.O(i)})(); 1 (()=>{var e,t={651(e,t,a){"use strict";const r=window.React,i=window.wp.element,n=window.wp.i18n,l=function(){return(0,r.createElement)("div",{className:"bk-header-main"},(0,r.createElement)("div",{className:"bk-icon"},(0,r.createElement)("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},(0,r.createElement)("rect",{x:"16",y:"16",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeOpacity:"0.85",strokeWidth:"1.8",fill:"currentColor",fillOpacity:"0.1"}),(0,r.createElement)("circle",{cx:"20",cy:"20",r:"1.5",stroke:"currentColor",strokeOpacity:"0.85",strokeWidth:"1.5",fill:"none"}),(0,r.createElement)("polyline",{points:"34 28 30 23 21 34",stroke:"currentColor",strokeOpacity:"0.85",strokeWidth:"1.8"}),(0,r.createElement)("circle",{cx:"11",cy:"11",r:"8.5",stroke:"currentColor",strokeWidth:"2.5",fill:"currentColor",fillOpacity:"0.18"}),(0,r.createElement)("circle",{cx:"8.5",cy:"8.5",r:"2",stroke:"currentColor",strokeOpacity:"0.4",strokeWidth:"1",fill:"none"}),(0,r.createElement)("line",{x1:"4.5",y1:"17.5",x2:"1",y2:"21",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round"}))),(0,r.createElement)("div",null,(0,r.createElement)("p",{className:"bk-title"},(0,i.createInterpolateElement)((0,n.__)("Bubuku Media Library <span>Settings</span>","bubuku-media-library"),{span:(0,r.createElement)("span",null)})),(0,r.createElement)("p",{className:"bk-subtitle"},(0,n.__)("Manage and optimize your WordPress media library","bubuku-media-library"))))},s=({icon:e,iconVariant:t="icon-accent",title:a,claim:i,animationDelay:n,headerMeta:l=null,children:s})=>{const o=n?{animationDelay:n}:void 0;return(0,r.createElement)("div",{className:"bk-dashboard-card",style:o},(0,r.createElement)("div",{className:"card-header"},(0,r.createElement)("div",{className:"card-header-main"},(0,r.createElement)("div",{className:`card-header-icon ${t}`},e),(0,r.createElement)("div",{className:"card-header-text"},(0,r.createElement)("h2",null,a),(0,r.createElement)("p",null,i))),l&&(0,r.createElement)("div",{className:"card-header-meta"},l)),(0,r.createElement)("div",{className:"card-body"},s))},o=()=>(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),(0,r.createElement)("polyline",{points:"22,6 12,13 2,6"})),u=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),(0,r.createElement)("polyline",{points:"17 21 17 13 7 13 7 21"}),(0,r.createElement)("polyline",{points:"7 3 7 8 15 8"})),c=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),m=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.createElement)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),d=()=>(0,r.createElement)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.createElement)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,r.createElement)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})),b=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,r.createElement)("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})),h=({reportsEmails:e,reportsDisable:t})=>{const[a,l]=(0,i.useState)(""),[h,p]=(0,i.useState)(0),[_,k]=(0,i.useState)(!1),[f,y]=(0,i.useState)(""),[g,E]=(0,i.useState)(""),[v,w]=(0,i.useState)(""),[N,x]=(0,i.useState)(!1),[C,S]=(0,i.useState)(""),[L,M]=(0,i.useState)(""),[T,D]=(0,i.useState)(""),R=`${BbkMediaLibrary.api_url}/set-notification-settings`,z=`${BbkMediaLibrary.api_url}/set-reports-disable`,A=`${BbkMediaLibrary.api_url}/send-manual-report`,O=`${BbkMediaLibrary.api_url}/get-report-preview-url`,I=BbkMediaLibrary._wpnonce,P=BbkMediaLibrary.rest_nonce;return(0,i.useEffect)(()=>{l(null!=e?e:""),p(null!=t?t:0)},[t,e]),(0,i.useEffect)(()=>{fetch(O,{method:"GET",headers:{"X-WP-Nonce":P}}).then(e=>e.json()).then(e=>{e&&e.preview_url&&D(e.preview_url)}).catch(()=>{})},[O,P]),(0,r.createElement)(s,{icon:(0,r.createElement)(o,null),title:(0,n.__)("Email notifications","bubuku-media-library"),claim:(0,n.__)("Receive automatic reports in your inbox","bubuku-media-library")},(0,r.createElement)("form",{id:"bbk-email-notifications-form",onSubmit:e=>{e.preventDefault(),y(""),E("");const t=a.split(",");let r=!0;t.forEach(e=>{e.trim().match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)||(r=!1)}),r?(k(!0),fetch(R,{method:"POST",body:JSON.stringify({emails:a,_wpnonce:I}),headers:{"Content-Type":"application/json","X-WP-Nonce":P}}).then(e=>e.json()).then(e=>{k(!1),e.success?y((0,n.__)("Settings saved successfully","bubuku-media-library")):E((0,n.__)("Error saving settings","bubuku-media-library"))}).catch(()=>{k(!1),E((0,n.__)("Network error. Please try again.","bubuku-media-library"))})):E((0,n.__)("Invalid email format","bubuku-media-library"))},className:"bbk-email-notifications"},(0,r.createElement)("div",{className:"form-row"},(0,r.createElement)("div",{className:"form-row__label"},(0,r.createElement)("span",{className:"form-row__title"},(0,n.__)("Emails to notify","bubuku-media-library")),(0,r.createElement)("span",{className:"form-row__help"},(0,n.__)("Comma separated","bubuku-media-library"))),(0,r.createElement)("div",{className:"form-row__control"},(0,r.createElement)("input",{type:"text",name:"emails",id:"bbk-emails",value:a,onChange:e=>{l(e.target.value),y(""),E("")},disabled:_}))),(0,r.createElement)("div",{className:"form-row form-row--separated"},(0,r.createElement)("div",{className:"form-row__label"},(0,r.createElement)("span",{className:"form-row__title"},(0,n.__)("Weekly reports","bubuku-media-library")),(0,r.createElement)("span",{className:"form-row__help"},(0,n.__)("Sending frequency","bubuku-media-library"))),(0,r.createElement)("div",{className:"form-row__control"},(0,r.createElement)("select",{name:"disable_reports",id:"disable_reports",value:h,onChange:e=>{const t=parseInt(e.target.value,10);p(t),fetch(z,{method:"POST",body:JSON.stringify({disable_reports:t,_wpnonce:I}),headers:{"Content-Type":"application/json","X-WP-Nonce":P}}).then(e=>e.json()).catch(()=>{})}},(0,r.createElement)("option",{value:"0"},(0,n.__)("Disabled","bubuku-media-library")),(0,r.createElement)("option",{value:"1"},(0,n.__)("Weekly","bubuku-media-library")),(0,r.createElement)("option",{value:"2"},(0,n.__)("Monthly","bubuku-media-library")))))),(0,r.createElement)("div",{className:"bbk-email-hint"},(0,r.createElement)(d,null),(0,r.createElement)("p",null,(0,n.__)("You will receive an email report with the file sizes of your media library. Use it to identify heavy images, optimize your site’s performance, and improve your users’ experience.","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-send-test"},(0,r.createElement)("div",{className:"bbk-send-test__header"},(0,r.createElement)("span",{className:"bbk-send-test__title"},(0,n.__)("Send test report","bubuku-media-library")),(0,r.createElement)("span",{className:"bbk-send-test__help"},(0,n.__)("Send the report to one or more addresses right now","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-send-test__row"},(0,r.createElement)("input",{className:"bbk-send-test__input",type:"text",value:v,placeholder:"email@example.com",onChange:e=>{w(e.target.value),S(""),M("")},disabled:N}),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary",onClick:()=>{S(""),M("");const e=v.trim();if(!e)return;const t=e.split(",");let a=!0;t.forEach(e=>{e.trim().match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)||(a=!1)}),a?(x(!0),fetch(A,{method:"POST",body:JSON.stringify({emails:e}),headers:{"Content-Type":"application/json","X-WP-Nonce":P}}).then(e=>e.json()).then(e=>{x(!1),e.sent?(S((0,n.__)("Report sent successfully","bubuku-media-library")),w("")):M(e.message||(0,n.__)("Error sending the report","bubuku-media-library"))}).catch(()=>{x(!1),M((0,n.__)("Network error. Please try again.","bubuku-media-library"))})):M((0,n.__)("Invalid email format","bubuku-media-library"))},disabled:N||!v.trim()},(0,r.createElement)(b,null),N?(0,n.__)("Sending…","bubuku-media-library"):(0,n.__)("Send now","bubuku-media-library"))),(C||L)&&(0,r.createElement)("div",{className:"bbk-send-test__feedback"},C&&(0,r.createElement)("p",{className:"form-feedback form-feedback--success"},(0,r.createElement)(c,null),C),L&&(0,r.createElement)("p",{className:"form-feedback form-feedback--error"},(0,r.createElement)(m,null),L)),T&&(0,r.createElement)("div",{className:"bbk-preview-url"},(0,r.createElement)("span",{className:"bbk-preview-url__label"},(0,n.__)("Preview email in browser:","bubuku-media-library")),(0,r.createElement)("a",{href:T,target:"_blank",rel:"noreferrer",className:"bbk-preview-url__link"},(0,n.__)("Open preview →","bubuku-media-library")))),(0,r.createElement)("div",{className:"bk-card-footer"},(f||g)&&(0,r.createElement)("div",{className:"bk-card-footer__info"},f&&(0,r.createElement)("p",{className:"form-feedback form-feedback--success"},(0,r.createElement)(c,null),f),g&&(0,r.createElement)("p",{className:"form-feedback form-feedback--error"},(0,r.createElement)(m,null),g)),(0,r.createElement)("button",{type:"submit",form:"bbk-email-notifications-form",className:"bk-btn bk-btn-primary",disabled:_},(0,r.createElement)(u,null),_?(0,n.__)("Saving…","bubuku-media-library"):(0,n.__)("Save","bubuku-media-library"))))},p=e=>parseInt(String(e).replace(/\D/g,""),10)||0,_=({good:e,medium:t,bad:a})=>{const i=p(e),l=p(t),s=p(a),o=i+l+s,u=o>0?(s/o*100).toFixed(1):"0",c=[{key:"good",label:(0,n.__)("Good size","bubuku-media-library"),count:null!=e?e:0,variant:"good"},{key:"medium",label:(0,n.__)("Medium size","bubuku-media-library"),count:null!=t?t:0,variant:"medium"},{key:"bad",label:(0,n.__)("Large size","bubuku-media-library"),count:null!=a?a:0,variant:"bad"}];return(0,r.createElement)("div",{className:"bbk-size-summary"},(0,r.createElement)("div",{className:"bbk-size-tiles"},c.map(e=>(0,r.createElement)("div",{key:e.key,className:`bbk-size-tile bbk-size-tile--${e.variant}`},(0,r.createElement)("div",{className:"bbk-size-tile__number"},e.count),(0,r.createElement)("div",{className:"bbk-size-tile__label"},e.label)))),(0,r.createElement)("div",{className:"bbk-size-bar"},(0,r.createElement)("div",{className:"bbk-size-bar__track"},o>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"bbk-size-bar__segment bbk-size-bar__segment--good",style:{flex:i}}),(0,r.createElement)("div",{className:"bbk-size-bar__segment bbk-size-bar__segment--medium",style:{flex:l}}),(0,r.createElement)("div",{className:"bbk-size-bar__segment bbk-size-bar__segment--bad",style:{flex:s}}))),(0,r.createElement)("div",{className:"bbk-size-bar__footer"},(0,r.createElement)("span",{className:"bbk-size-bar__total"},(0,n.__)("Total:","bubuku-media-library")," ",(0,r.createElement)("strong",null,o.toLocaleString())," ",(0,n.__)("images analyzed","bubuku-media-library")),s>0&&(0,r.createElement)("span",{className:"bbk-size-bar__attention"},u,"% ",(0,n.__)("require attention","bubuku-media-library")))))},k=2*Math.PI*45,f=e=>parseInt(String(e).replace(/\D/g,""),10)||0,y=({altEmpty:e,total:t,withoutAlt:a,withAlt:i})=>{const l=f(null!=a?a:e),s=f(t),o=f(i),u=s>0?Math.min(l,s):l,c=o>0?o:Math.max(s-u,0),m=s>0?Math.min(l,s):0,d=s>0?Math.round(m/s*100):0,b=k*(1-d/100),h=(e=>e<10?"var(--green-500)":e<30?"var(--accent-dark)":"var(--red-500)")(d);return(0,r.createElement)("div",{className:"bbk-summary-alt-chart"},(0,r.createElement)("svg",{className:"bbk-summary-alt-chart__donut",width:"100",height:"100",viewBox:"0 0 100 100","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"50",cy:"50",r:45,fill:"none",stroke:"var(--border)",strokeWidth:"10"}),(0,r.createElement)("circle",{cx:"50",cy:"50",r:45,fill:"none",stroke:h,strokeWidth:"10",strokeDasharray:k,strokeDashoffset:b,strokeLinecap:"round",transform:"rotate(-90 50 50)"}),(0,r.createElement)("text",{x:"50",y:"46",textAnchor:"middle",dominantBaseline:"middle",fontSize:"16",fontWeight:"700",fill:h},d,"%"),(0,r.createElement)("text",{x:"50",y:"62",textAnchor:"middle",dominantBaseline:"middle",fontSize:"9",fill:"var(--text-muted)"},(0,n.__)("missing","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-summary-alt-chart__legend"},(0,r.createElement)("div",{className:"bbk-summary-alt-chart__legend-item"},(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-dot bbk-summary-alt-chart__legend-dot--missing"}),(0,n.__)("Without ALT","bubuku-media-library"),(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-value"},l.toLocaleString())),(0,r.createElement)("div",{className:"bbk-summary-alt-chart__legend-item"},(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-dot bbk-summary-alt-chart__legend-dot--present"}),(0,n.__)("With ALT","bubuku-media-library"),(0,r.createElement)("span",{className:"bbk-summary-alt-chart__legend-value"},c.toLocaleString()))))},g=e=>parseInt(String(e).replace(/\D/g,""),10)||0,E=()=>(0,r.createElement)("div",{className:"bbk-summary-skeleton"},(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--full"}),(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--medium"}),(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--full"}),(0,r.createElement)("div",{className:"bbk-summary-skeleton__line bbk-summary-skeleton__line--short"})),v=()=>{const[e,t]=(0,i.useState)(""),[a,l]=(0,i.useState)(!1),[o,u]=(0,i.useState)(!0),[c,m]=(0,i.useState)(null),[d,b]=(0,i.useState)(!0),p=BbkMediaLibrary.api_url.endsWith("/")?BbkMediaLibrary.api_url.slice(0,-1):BbkMediaLibrary.api_url,k=`${p}/get-notification-settings`,f=`${p}/get-summary-stats`,v=BbkMediaLibrary._wpnonce;(0,i.useEffect)(()=>{fetch(k,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(e=>{t(e.data.emails),l(e.data.disabled),u(!1)})},[k,v]),(0,i.useEffect)(()=>{fetch(f,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(e=>{m(e),b(!1)}).catch(()=>{b(!1)})},[f]);let w=0;return c?.totals?.images_total?w=g(c.totals.images_total):c?.img_sizes&&(w=g(c.img_sizes.good)+g(c.img_sizes.medium)+g(c.img_sizes.bad)),(0,r.createElement)("div",{className:"bbk-dashboard"},(0,r.createElement)("div",{className:"bbk-summary-grid"},(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,r.createElement)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,r.createElement)("polyline",{points:"21 15 16 10 5 21"})),iconVariant:"icon-accent",title:(0,n.__)("Image Size","bubuku-media-library"),claim:(0,n.__)("Distribution by weight quality","bubuku-media-library"),animationDelay:".05s"},d?(0,r.createElement)(E,null):(0,r.createElement)(_,{good:c?.img_sizes?.good,medium:c?.img_sizes?.medium,bad:c?.img_sizes?.bad})),(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},(0,r.createElement)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,r.createElement)("circle",{cx:"12",cy:"12",r:"3"})),title:(0,n.__)("ALT Accessibility","bubuku-media-library"),claim:(0,n.__)("Images without alternative text","bubuku-media-library"),animationDelay:".1s"},d?(0,r.createElement)(E,null):(0,r.createElement)(y,{altEmpty:c?.img_alt_empty,total:w,withoutAlt:c?.totals?.without_alt,withAlt:c?.totals?.with_alt}))),!o&&(0,r.createElement)(h,{reportsEmails:e,reportsDisable:a}))},w=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"7 10 12 15 17 10"}),(0,r.createElement)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})),N=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),x=()=>{const[e,t]=(0,i.useState)("all"),[a,l]=(0,i.useState)("all"),[s,o]=(0,i.useState)(!1),[u,c]=(0,i.useState)(!1);let m=null;return m=u?(0,n.__)("Exporting…","bubuku-media-library"):s?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(N,null),(0,n.__)("Downloaded!","bubuku-media-library")):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(w,null),(0,n.__)("Export CSV","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-export-form"},(0,r.createElement)("div",{className:"bk-filters-grid"},(0,r.createElement)("div",{className:"bk-filter-group"},(0,r.createElement)("span",{className:"bk-filter-label"},(0,n.__)("Filter by ALT text","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-chip-group",role:"group","aria-label":(0,n.__)("Filter by ALT text","bubuku-media-library")},(0,r.createElement)("button",{type:"button",className:"bk-chip"+("all"===e?" bk-chip--active":""),onClick:()=>t("all"),"aria-pressed":"all"===e},(0,n.__)("All","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip"+("none"===e?" bk-chip--active":""),onClick:()=>t("none"),"aria-pressed":"none"===e},(0,n.__)("Without ALT","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip"+("some"===e?" bk-chip--active":""),onClick:()=>t("some"),"aria-pressed":"some"===e},(0,n.__)("With ALT","bubuku-media-library")))),(0,r.createElement)("div",{className:"bk-filter-group"},(0,r.createElement)("span",{className:"bk-filter-label"},(0,n.__)("Filter by size","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-chip-group",role:"group","aria-label":(0,n.__)("Filter by size","bubuku-media-library")},(0,r.createElement)("button",{type:"button",className:"bk-chip"+("all"===a?" bk-chip--active":""),onClick:()=>l("all"),"aria-pressed":"all"===a},(0,n.__)("All","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip bk-chip--good"+("good"===a?" bk-chip--active":""),onClick:()=>l("good"),"aria-pressed":"good"===a},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--good","aria-hidden":"true"}),(0,n.__)("Good","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip bk-chip--mid"+("mid"===a?" bk-chip--active":""),onClick:()=>l("mid"),"aria-pressed":"mid"===a},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--mid","aria-hidden":"true"}),(0,n.__)("Medium","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-chip bk-chip--bad"+("bad"===a?" bk-chip--active":""),onClick:()=>l("bad"),"aria-pressed":"bad"===a},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--bad","aria-hidden":"true"}),(0,n.__)("Bad","bubuku-media-library"))))),(0,r.createElement)("div",{className:"bk-size-legend"},(0,r.createElement)("div",{className:"bk-size-legend__item"},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--good","aria-hidden":"true"}),(0,r.createElement)("strong",{className:"bk-size-legend__label bk-size-legend__label--good"},(0,n.__)("Good","bubuku-media-library")),"< 100 KB"),(0,r.createElement)("div",{className:"bk-size-legend__item"},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--mid","aria-hidden":"true"}),(0,r.createElement)("strong",{className:"bk-size-legend__label bk-size-legend__label--mid"},(0,n.__)("Medium","bubuku-media-library")),"100–500 KB"),(0,r.createElement)("div",{className:"bk-size-legend__item"},(0,r.createElement)("span",{className:"bk-size-dot bk-size-dot--bad","aria-hidden":"true"}),(0,r.createElement)("strong",{className:"bk-size-legend__label bk-size-legend__label--bad"},(0,n.__)("Bad","bubuku-media-library")),"> 500 KB")),(0,r.createElement)("div",{className:"bk-card-footer"},(0,r.createElement)("p",{className:"bk-card-footer__info bk-export-count"},(0,n.__)("Exporting","bubuku-media-library")," ",(0,r.createElement)("strong",null,(()=>{if("all"===e&&"all"===a)return(0,n.__)("all files","bubuku-media-library");const t=[];if("all"!==e&&t.push("none"===e?(0,n.__)("without ALT","bubuku-media-library"):(0,n.__)("with ALT","bubuku-media-library")),"all"!==a){const e={good:(0,n.__)("Good (< 100 KB)","bubuku-media-library"),mid:(0,n.__)("Medium (100–500 KB)","bubuku-media-library"),bad:(0,n.__)("Bad (> 500 KB)","bubuku-media-library")};t.push(e[a])}return t.join(", ")})())),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-primary",onClick:async()=>{c(!0);try{var t;const r=new URLSearchParams({alt_filter:e,size_filter:a}),i=await fetch(`${BbkMediaLibrary.api_url}/export-csv?${r}`,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}});if(!i.ok)throw new Error(`Error ${i.status}: ${i.statusText}`);const n=(null!==(t=i.headers.get("Content-Disposition"))&&void 0!==t?t:"").match(/filename="([^"]+)"/),l=n?n[1]:`media-library-export-${(new Date).toISOString().slice(0,10)}.csv`,s=await i.blob(),u=URL.createObjectURL(s),c=Object.assign(document.createElement("a"),{href:u,download:l});document.body.appendChild(c),c.click(),c.remove(),URL.revokeObjectURL(u),o(!0),setTimeout(()=>o(!1),3e3)}catch(e){console.error("CSV export failed:",e)}finally{c(!1)}},disabled:u},m)))};var C=a(809),S=a.n(C);const L={UPDATED:"updated",UNCHANGED:"unchanged",CLEARED:"cleared",REJECTED:"rejected",SKIPPED_PERMISSION:"skipped_permission",OVERWRITTEN_DUPLICATE:"overwritten_duplicate",NOT_APPLIED:"not_applied",UNCONFIRMED:"unconfirmed"},M=[L.REJECTED,L.SKIPPED_PERMISSION,L.NOT_APPLIED,L.UNCONFIRMED],T=Object.values(L),D=["Source Row","Import Status","Import Reason"],R=e=>{const{status:t,reason:a,supersededBy:r}=e;if(t===L.OVERWRITTEN_DUPLICATE&&r)return(0,n.sprintf)(/* translators: %d: CSV row number */ /* translators: %d: CSV row number */ 2 (0,n.__)("Same ID as row %d, which is imported instead.","bubuku-media-library"),r);if(t===L.CLEARED)return(0,n.__)("The CSV had an empty ALT text, so the existing one was removed.","bubuku-media-library");if(t===L.SKIPPED_PERMISSION)return(0,n.__)("You are not allowed to edit this attachment.","bubuku-media-library");switch(a){case"invalid_id":return(0,n.__)("The ID is missing or not a number.","bubuku-media-library");case"not_attachment":return(0,n.__)("No attachment exists with this ID.","bubuku-media-library");case"invalid_alt":return(0,n.__)("The Alt Text value is missing.","bubuku-media-library");case"write_failed":return(0,n.__)("The ALT text could not be saved.","bubuku-media-library");case"http_429":return(0,n.__)("The server was busy and rejected the batch repeatedly.","bubuku-media-library");case"http_401":case"http_403":return(0,n.__)("The session expired or you do not have permission. Reload the page and try again.","bubuku-media-library");case"network_error":return(0,n.__)("The connection failed; the server may have applied this row.","bubuku-media-library");case"invalid_response":return(0,n.__)("The server response could not be read; the server may have applied this row.","bubuku-media-library");default:return/^http_5/.test(a||"")?(0,n.__)("The server failed to answer; it may have applied this row.","bubuku-media-library"):/^http_4/.test(a||"")?(0,n.__)("The server rejected the batch.","bubuku-media-library"):a||""}},z=e=>new Promise(t=>{setTimeout(t,e)}),A=e=>{const t=String(null!=e?e:"").trim();return/^\d+$/.test(t)?Number(t):0},O=async({apiUrl:e,nonce:t,rows:a,retryDelayMs:r=2e3,onRetry:i})=>{let n,l;for(let l=0;;l++){try{n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":t},body:JSON.stringify({rows:a})})}catch(e){return{kind:L.UNCONFIRMED,reason:"network_error"}}if(429!==n.status||l>=3)break;i&&i(l+1),await z(r*(l+1))}if(n.status>=400&&n.status<500)return{kind:L.NOT_APPLIED,reason:`http_${n.status}`};if(!n.ok)return{kind:L.UNCONFIRMED,reason:`http_${n.status}`};try{l=await n.json()}catch(e){return{kind:L.UNCONFIRMED,reason:"invalid_response"}}const s=l?.data?.results;return l?.success&&Array.isArray(s)&&s.length===a.length?{kind:"ok",results:s}:{kind:L.UNCONFIRMED,reason:"invalid_response"}},I=(e,t)=>{var a,r;return{recordNumber:e.recordNumber,id:null!==(a=e.data.ID)&&void 0!==a?a:"",alt:null!==(r=e.data["Alt Text"])&&void 0!==r?r:"",original:e.data,...t}},P=e=>{const t=Object.fromEntries(T.map(e=>[e,0]));return e.forEach(e=>{t[e.status]+=1}),t},B=e=>D.map(t=>{let a=t;for(;e.includes(a);)a=`${a}_`;return a});let j=null;const W=()=>j,U=e=>{j=e},F=[L.UPDATED,L.UNCHANGED],$=({report:e})=>{const[t,a]=(0,i.useState)(100),{counts:l,pending:s}=e,o=e.results.filter(e=>!F.includes(e.status)),u=s.length>0,c=u?(0,n.sprintf)(/* translators: %d: number of pending rows */ /* translators: %d: number of pending rows */ 3 (0,n._n)("%d row needs attention","%d rows need attention",s.length,"bubuku-media-library"),s.length):(0,n.__)("Import complete","bubuku-media-library"),m=[l[L.UPDATED]>0&&(0,n.sprintf)(/* translators: %d: number of updated ALT texts */ /* translators: %d: number of updated ALT texts */ 4 (0,n.__)("%d updated","bubuku-media-library"),l[L.UPDATED]),l[L.CLEARED]>0&&(0,n.sprintf)(/* translators: %d: number of ALT texts that were emptied */ /* translators: %d: number of ALT texts that were emptied */ 5 (0,n.__)("%d cleared","bubuku-media-library"),l[L.CLEARED]),l[L.UNCHANGED]>0&&(0,n.sprintf)(/* translators: %d: number of ALT texts that already had that value */ /* translators: %d: number of ALT texts that already had that value */ 6 (0,n.__)("%d unchanged","bubuku-media-library"),l[L.UNCHANGED])].filter(Boolean).join(", "),d=(0,n.__)("Review the pending rows below, or download them, fix them and import the file again.","bubuku-media-library");let b=m?`${m}.`:"";return u&&(b=m?(0,n.sprintf)(/* translators: 1: summary such as "182 updated, 14 unchanged", 2: what to do with the pending rows */ /* translators: 1: summary such as "182 updated, 14 unchanged", 2: what to do with the pending rows */ 7 (0,n.__)("%1$s. %2$s","bubuku-media-library"),m,d):d),(0,r.createElement)("section",{className:"bbk-import-report"},(0,r.createElement)("div",{className:"bbk-import-report__head"},(0,r.createElement)("div",{role:"status"},(0,r.createElement)("h3",{className:"bbk-import-report__title bbk-import-report__title--"+(u?"attention":"ok")},c),(0,r.createElement)("p",{className:"bbk-import-report__lead"},b)),u&&(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bbk-import-report__download",onClick:()=>{((e,t)=>{const a=new Blob([e],{type:"text/csv;charset=utf-8"}),r=URL.createObjectURL(a),i=document.createElement("a");i.href=r,i.download=t,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),0)})((e=>{const t=e.fields,a=e.pending.map(e=>[...t.map(t=>(e=>{const t=String(null!=e?e:"");return/^'?[=+\-@\t\r]/.test(t)?`'${t}`:t})(e.original[t])),e.recordNumber,e.status,R(e)]);return`\ufeff${S().unparse({fields:[...t,...B(t)],data:a},{delimiter:",",newline:"\r\n"})}`})(e),`${(e.fileName||"alt-import").replace(/\.csv$/i,"")}-pending.csv`)}},(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"7 10 12 15 17 10"}),(0,r.createElement)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})),(0,n.__)("Download pending rows CSV","bubuku-media-library"))),e.normalized>0&&(0,r.createElement)("p",{className:"bbk-import-report__note"},(0,n.sprintf)(/* translators: %d: number of ALT texts changed by sanitization */ /* translators: %d: number of ALT texts changed by sanitization */ 8 (0,n._n)("%d ALT text was normalized (HTML tags or extra whitespace removed) before saving.","%d ALT texts were normalized (HTML tags or extra whitespace removed) before saving.",e.normalized,"bubuku-media-library"),e.normalized)),l[L.UNCONFIRMED]>0&&(0,r.createElement)("p",{className:"bbk-import-report__warning"},(0,n.__)("Unconfirmed rows: the connection failed before the response arrived, so the server may have applied them. Check those images before importing them again.","bubuku-media-library")),o.length>0&&(0,r.createElement)("details",{className:"bbk-import-report__details"},(0,r.createElement)("summary",null,(0,n.sprintf)(/* translators: %d: number of rows listed in the detail */ /* translators: %d: number of rows listed in the detail */ 9 (0,n._n)("Details of %d affected row","Details of %d affected rows",o.length,"bubuku-media-library"),o.length)),(0,r.createElement)("div",{className:"bbk-import-report__table-wrap",role:"region",tabIndex:0,"aria-label":(0,n.__)("Affected rows","bubuku-media-library")},(0,r.createElement)("table",{className:"bbk-import-report__table"},(0,r.createElement)("thead",null,(0,r.createElement)("tr",null,(0,r.createElement)("th",{scope:"col"},(0,n.__)("Row","bubuku-media-library")),(0,r.createElement)("th",{scope:"col"},(0,n.__)("ID","bubuku-media-library")),(0,r.createElement)("th",{scope:"col"},(0,n.__)("Alt Text","bubuku-media-library")),(0,r.createElement)("th",{scope:"col"},(0,n.__)("Status","bubuku-media-library")),(0,r.createElement)("th",{scope:"col"},(0,n.__)("Reason","bubuku-media-library")))),(0,r.createElement)("tbody",null,o.slice(0,t).map(e=>{return(0,r.createElement)("tr",{key:e.recordNumber},(0,r.createElement)("td",null,e.recordNumber),(0,r.createElement)("td",null,e.id),(0,r.createElement)("td",{className:"bbk-import-report__alt"},""===e.alt?(0,r.createElement)("em",{className:"bbk-import-report__empty"},(0,n.__)("(empty)","bubuku-media-library")):e.alt),(0,r.createElement)("td",null,(0,r.createElement)("span",{className:"bbk-import-report__status bbk-import-report__status--"+(t=e.status,[L.UPDATED,L.CLEARED,L.UNCHANGED].includes(t)?"ok":t===L.OVERWRITTEN_DUPLICATE?"neutral":"bad")},(e=>{switch(e){case L.UPDATED:return(0,n.__)("Updated","bubuku-media-library");case L.CLEARED:return(0,n.__)("ALT cleared","bubuku-media-library");case L.UNCHANGED:return(0,n.__)("Unchanged","bubuku-media-library");case L.REJECTED:return(0,n.__)("Rejected","bubuku-media-library");case L.SKIPPED_PERMISSION:return(0,n.__)("Skipped (no permission)","bubuku-media-library");case L.OVERWRITTEN_DUPLICATE:return(0,n.__)("Replaced by a later row","bubuku-media-library");case L.NOT_APPLIED:return(0,n.__)("Not applied (safe to retry)","bubuku-media-library");case L.UNCONFIRMED:return(0,n.__)("Unconfirmed result","bubuku-media-library");default:return e}})(e.status))),(0,r.createElement)("td",{className:"bbk-import-report__reason"},R(e)));var t})))),o.length>t&&(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bbk-import-report__more",onClick:()=>a(t+100)},(0,n.sprintf)(/* translators: %1$d: rows shown, %2$d: total affected rows */ /* translators: %1$d: rows shown, %2$d: total affected rows */ 10 (0,n.__)("Show more (%1$d of %2$d)","bubuku-media-library"),t,o.length))))},H=()=>(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.createElement)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),V=()=>{const[e,t]=(0,i.useState)(null),[a,l]=(0,i.useState)(!1),[s,o]=(0,i.useState)(null),[u,c]=(0,i.useState)(""),[m,d]=(0,i.useState)(W),[b,h]=(0,i.useState)(!1),p=(0,i.useRef)(null),_=`${BbkMediaLibrary.api_url}/import-alt-chunk`,k=BbkMediaLibrary.rest_nonce,f=["ID","Alt Text"],y=e=>{var t;return(null!==(t=e?.name)&&void 0!==t?t:"").toLowerCase().endsWith(".csv")},g=()=>{p.current&&p.current.click()},E=s?Math.round((s.done?s.chunk:s.chunk-1)/s.totalChunks*100):0;let v=(0,n.__)("Processing…","bubuku-media-library");return s&&s.chunk>0&&(v=s.retry>0?(0,n.sprintf)(/* translators: %1$d: current batch, %2$d: total batches, %3$d: retry number, %4$d: max retries */ /* translators: %1$d: current batch, %2$d: total batches, %3$d: retry number, %4$d: max retries */ 11 (0,n.__)("Batch %1$d of %2$d: server busy, retrying (%3$d/%4$d)…","bubuku-media-library"),s.chunk,s.totalChunks,s.retry,3):(0,n.sprintf)(/* translators: %1$d: current batch, %2$d: total batches, %3$d: progress percentage */ /* translators: %1$d: current batch, %2$d: total batches, %3$d: progress percentage */ 12 (0,n.__)("Batch %1$d of %2$d (%3$d%%)…","bubuku-media-library"),s.chunk,s.totalChunks,E)),(0,r.createElement)("form",{id:"bbk-import-alt-form",onSubmit:async a=>{if(a.preventDefault(),!e)return void c((0,n.__)("Please select a CSV file.","bubuku-media-library"));let r;l(!0),c("");try{r=await(e=>new Promise((t,a)=>{S().parse(e,{header:!0,skipEmptyLines:!1,complete:t,error:a})}))(e)}catch(e){return l(!1),void c((0,n.sprintf)(/* translators: %s: error message */ /* translators: %s: error message */ 13 (0,n.__)("Failed to parse CSV: %s","bubuku-media-library"),e.message))}const i=r.meta.fields||[],s=f.filter(e=>!i.includes(e));if(s.length>0)return l(!1),void c((0,n.sprintf)(/* translators: %s: comma-separated list of missing column names */ /* translators: %s: comma-separated list of missing column names */ 14 (0,n.__)("Invalid CSV structure. Missing required columns: %s","bubuku-media-library"),s.join(", ")));const u=((e=[])=>{const t=e.filter(e=>"Quotes"===e.type),a=t.filter(e=>Number.isInteger(e.row)).map(e=>e.row+1);return{blocked:t.length>0,rows:[...new Set(a)].sort((e,t)=>e-t)}})(r.errors);if(u.blocked)return l(!1),void c(u.rows.length>0?(0,n.sprintf)(/* translators: %s: comma-separated row numbers */ /* translators: %s: comma-separated row numbers */ 15 (0,n.__)("The CSV has malformed quoted fields (near row %s), so it cannot be read reliably. Nothing was imported. Fix the file and try again.","bubuku-media-library"),u.rows.slice(0,5).join(", ")):(0,n.__)("The CSV has malformed quoted fields, so it cannot be read reliably. Nothing was imported. Fix the file and try again.","bubuku-media-library"));const m=r.data.map((e,t)=>({recordNumber:t+2,data:e})).filter(e=>{return t=e.data,!Object.values(t).every(e=>""===String(null!=e?e:"").trim());var t});if(0===m.length)return l(!1),void c((0,n.__)("The CSV file is empty.","bubuku-media-library"));d(null),U(null),o({chunk:0,totalChunks:1,retry:0});try{const t=await(async({records:e,apiUrl:t,nonce:a,chunkSize:r=100,retryDelayMs:i,onProgress:n})=>{const l=(e=>{const t=new Map;e.forEach(e=>{const a=A(e.data.ID);a>0&&t.set(a,e.recordNumber)});const a=new Map;return e.forEach(e=>{const r=A(e.data.ID),i=r>0?t.get(r):void 0;void 0!==i&&i!==e.recordNumber&&a.set(e.recordNumber,i)}),a})(e),s=[],o=[];e.forEach(e=>{l.has(e.recordNumber)?s.push(I(e,{status:L.OVERWRITTEN_DUPLICATE,supersededBy:l.get(e.recordNumber)})):o.push(e)});const u=Math.ceil(o.length/r);for(let e=0;e<u;e++){const l=o.slice(e*r,(e+1)*r),c=(t=0)=>n&&n({chunk:e+1,totalChunks:u,retry:t});c();const m=await O({apiUrl:t,nonce:a,retryDelayMs:i,rows:l.map(e=>({ID:e.data.ID,"Alt Text":e.data["Alt Text"]})),onRetry:c});l.forEach((e,t)=>{if("ok"!==m.kind)return void s.push(I(e,{status:m.kind,reason:m.reason}));const a=m.results[t]||{};T.includes(a.status)?s.push(I(e,{status:a.status,reason:a.reason,normalized:Boolean(a.normalized)})):s.push(I(e,{status:L.UNCONFIRMED,reason:"invalid_response"}))}),n&&n({chunk:e+1,totalChunks:u,retry:0,done:!0})}return s.sort((e,t)=>e.recordNumber-t.recordNumber),s})({records:m,apiUrl:_,nonce:k,onProgress:o}),a=(({fileName:e,fields:t,results:a})=>({fileName:e,fields:t,results:a,counts:P(a),normalized:a.filter(e=>e.normalized).length,pending:a.filter(e=>M.includes(e.status))}))({fileName:e.name,fields:i,results:t});U(a),d(a)}catch(e){console.error("Import failed:",e),c((0,n.__)("The import could not be completed.","bubuku-media-library"))}l(!1),o(null),t(null),p.current&&(p.current.value="")}},(0,r.createElement)("div",{className:"upload-zone"+(b?" upload-zone--dragging":""),id:"import-zone",onClick:g,onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.preventDefault(),h(!1)},onDrop:e=>{e.preventDefault(),h(!1);const a=e.dataTransfer.files[0]||null;if(a){if(!y(a))return void c((0,n.__)("Only .CSV files are accepted.","bubuku-media-library"));t(a),c("")}},onKeyDown:e=>"Enter"===e.key&&g(),role:"button",tabIndex:0,"aria-label":(0,n.__)("Click to select or drag a CSV file here","bubuku-media-library")},(0,r.createElement)("input",{ref:p,type:"file",id:"import-file",name:"csv_file",accept:".csv",onChange:e=>{const a=e.target.files[0]||null;if(a&&!y(a))return c((0,n.__)("Only .CSV files are accepted.","bubuku-media-library")),void(e.target.value="");t(a),c("")},disabled:a,style:{display:"none"}}),(0,r.createElement)("div",{className:"upload-zone-icon"},(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.createElement)("polyline",{points:"14 2 14 8 20 8"}),(0,r.createElement)("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),(0,r.createElement)("line",{x1:"9",y1:"15",x2:"15",y2:"15"}))),(0,r.createElement)("p",null,(0,r.createElement)("strong",null,(0,n.__)("Click to select","bubuku-media-library"))," ",(0,n.__)("or drag your file here","bubuku-media-library")),(0,r.createElement)("p",{className:"upload-hint"},(0,n.__)("Only .CSV files","bubuku-media-library"))),(0,r.createElement)("div",{className:"bk-card-footer"},(e||a&&s||u)&&(0,r.createElement)("div",{className:"bk-card-footer__info"},e&&(0,r.createElement)("div",{className:"file-selected",id:"import-selected"},(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),(0,r.createElement)("span",null,(0,n.__)("Selected file:","bubuku-media-library")," ",(0,r.createElement)("span",{className:"file-name"},e.name))),a&&s&&(0,r.createElement)("div",{className:"bk-progress-bar"},(0,r.createElement)("div",{className:"bk-progress-bar__track"},(0,r.createElement)("div",{className:"bk-progress-bar__fill",style:{width:`${E}%`}})),(0,r.createElement)("span",{className:"bk-progress-bar__label",role:"status"},v)),u&&(0,r.createElement)("p",{className:"bbk-notice bbk-notice--error"},(0,r.createElement)(H,null),u)),(0,r.createElement)("button",{type:"submit",className:"bk-btn bk-btn-primary",id:"import-btn",disabled:a||!e},(0,r.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"17 8 12 3 7 8"}),(0,r.createElement)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),a?(0,n.__)("Importing…","bubuku-media-library"):(0,n.__)("Import ALT text","bubuku-media-library"))),m&&(0,r.createElement)($,{report:m}))},q=()=>(0,r.createElement)("div",{className:"bbk-dashboard"},(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"7 10 12 15 17 10"}),(0,r.createElement)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})),title:(0,n.__)("Export ALT text to CSV","bubuku-media-library"),claim:(0,n.__)("Download a CSV with image data filtered by your selection","bubuku-media-library"),animationDelay:".05s"},(0,r.createElement)(x,null)),(0,r.createElement)(s,{icon:(0,r.createElement)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"17 8 12 3 7 8"}),(0,r.createElement)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),title:(0,n.__)("Import ALT text from CSV","bubuku-media-library"),claim:(0,n.__)("Upload the exported CSV file to update the ALT text of the images","bubuku-media-library"),animationDelay:".1s"},(0,r.createElement)(V,null))),K='This image file size is too large to upload. To reduce the file size, go to: <a href="https://squoosh.app/" target="_blank" rel="noopener noreferrer">https://squoosh.app/</a> , upload your image and on the controls select <strong>AVIF</strong> under the heading Compress, and set the quality to 80 or above. Download, and upload this new file.',G={enabled:!1,max_size_mb:1,message:K,image_id:0,image_url:"",image_alt:""},J=e=>{if(!e||!e.success||!e.data)return null;const t=e.data;return{enabled:Boolean(t.enabled),max_size_mb:Number(t.max_size_mb)||G.max_size_mb,message:"string"==typeof t.message&&""!==t.message?t.message:K,image_id:Number(t.image_id)||0,image_url:"string"==typeof t.image_url?t.image_url:"",image_alt:"string"==typeof t.image_alt?t.image_alt:""}},X=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.createElement)("polyline",{points:"17 8 12 3 7 8"}),(0,r.createElement)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})),Z=()=>{const[e,t]=(0,i.useState)(!0),[a,l]=(0,i.useState)(!1),[o,u]=(0,i.useState)(""),[c,m]=(0,i.useState)(""),[d,b]=(0,i.useState)(G),h=(0,i.useRef)(null),p=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/get-upload-limit-settings`,[]),_=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/set-upload-limit-settings`,[]);(0,i.useEffect)(()=>{fetch(p,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(e=>{const a=J(e);a&&b(a),t(!1)}).catch(()=>{u((0,n.__)("Could not load upload limit settings. Please refresh and try again.","bubuku-media-library")),t(!1)})},[p]);const k=(e,t)=>{b(a=>({...a,[e]:t}))},f=!d.enabled;return(0,r.createElement)(s,{title:(0,n.__)("Upload size limit","bubuku-media-library"),claim:(0,n.__)("Block images above a configurable size before they reach the library.","bubuku-media-library"),icon:(0,r.createElement)(X,null),animationDelay:".08s"},(0,r.createElement)("div",{className:"bbk-upload-limit-card"},e&&(0,r.createElement)("p",{className:"bbk-tools-placeholder"},(0,n.__)("Loading upload limit settings…","bubuku-media-library")),!e&&o&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--error"},o),!e&&c&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--success"},c),!e&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"bbk-upload-limit-layout"},(0,r.createElement)("div",{className:"bbk-upload-limit-row bbk-upload-limit-row--toggle"},(0,r.createElement)("label",{className:"bbk-tools-toggle",htmlFor:"bbk-upload-limit-enabled","aria-label":(0,n.__)("Enable upload size limit","bubuku-media-library")},(0,r.createElement)("input",{id:"bbk-upload-limit-enabled",type:"checkbox",checked:d.enabled,onChange:e=>k("enabled",e.target.checked)})),(0,r.createElement)("div",{className:"bbk-upload-limit-row-text"},(0,r.createElement)("strong",null,(0,n.__)("Block oversized image uploads","bubuku-media-library")),(0,r.createElement)("p",null,(0,n.__)("Applies to every role, administrators included. Only image files are affected.","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--size"},(0,r.createElement)("label",{htmlFor:"bbk-upload-limit-max-size"},(0,n.__)("Maximum size","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-max-size-input"},(0,r.createElement)("input",{id:"bbk-upload-limit-max-size",type:"number",step:"0.1",min:"0.1",max:"64",disabled:f,value:d.max_size_mb,onChange:e=>k("max_size_mb",""===e.target.value?"":Number(e.target.value))}),(0,r.createElement)("span",null,(0,n.__)("MB","bubuku-media-library"))),(0,r.createElement)("p",{className:"bbk-upload-limit-hint"},(0,n.__)("Only applies to image files (image/*).","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--message"},(0,r.createElement)("div",{className:"bbk-upload-limit-field-header"},(0,r.createElement)("label",{htmlFor:"bbk-upload-limit-message"},(0,n.__)("Message shown to editors","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",disabled:f,onClick:()=>{k("message",K)}},(0,n.__)("Restore default message","bubuku-media-library"))),(0,r.createElement)("textarea",{id:"bbk-upload-limit-message",rows:"8",className:"bbk-upload-limit-message-input",disabled:f,value:d.message,onChange:e=>k("message",e.target.value)}),(0,r.createElement)("p",{className:"bbk-upload-limit-hint"},(0,n.__)("Allowed tags: a, strong, b, em, i, br, p, ul, ol, li, code, span.","bubuku-media-library"))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--image"},(0,r.createElement)("span",{className:"bbk-upload-limit-field-label"},(0,n.__)("Supporting image","bubuku-media-library")),d.image_url?(0,r.createElement)("div",{className:"bbk-upload-limit-image-preview"},(0,r.createElement)("img",{src:d.image_url,alt:d.image_alt})):(0,r.createElement)("p",{className:"bbk-upload-limit-hint"},(0,n.__)("No image selected.","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-image-actions"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",disabled:f,onClick:()=>{"undefined"!=typeof wp&&wp.media&&(h.current||(h.current=wp.media({title:(0,n.__)("Select an image","bubuku-media-library"),library:{type:"image"},multiple:!1}),h.current.on("select",()=>{const e=h.current.state().get("selection"),t=e?e.first():null;if(!t)return;const a=t.toJSON();b(e=>({...e,image_id:a.id,image_url:a.sizes?.large?.url||a.url,image_alt:a.alt||""}))})),h.current.open())}},d.image_url?(0,n.__)("Replace image","bubuku-media-library"):(0,n.__)("Select image","bubuku-media-library")),d.image_url&&(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",disabled:f,onClick:()=>{b(e=>({...e,image_id:0,image_url:"",image_alt:""}))}},(0,n.__)("Remove","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-upload-limit-field bbk-upload-limit-field--preview"},(0,r.createElement)("span",{className:"bbk-upload-limit-field-label"},(0,n.__)("Preview","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-mock-overlay","aria-hidden":"true"},(0,r.createElement)("div",{className:"bbk-upload-limit-mock-dialog"},(0,r.createElement)("span",{className:"bbk-upload-limit-mock-close"},"×"),(0,r.createElement)("h3",{className:"bbk-upload-limit-mock-title"},(0,n.__)("Image too large","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-upload-limit-mock-body",dangerouslySetInnerHTML:{__html:d.message}}),(0,r.createElement)("ul",{className:"bbk-upload-limit-mock-files"},(0,r.createElement)("li",null,"example-photo.jpg"," ",(0,r.createElement)("span",{className:"bbk-upload-limit-mock-file-size"},"(2.4 MB)"))),d.image_url&&(0,r.createElement)("img",{className:"bbk-upload-limit-mock-image",src:d.image_url,alt:""}))))),(0,r.createElement)("div",{className:"bbk-tools-actions"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-primary",onClick:()=>{l(!0),u(""),m(""),fetch(_,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":BbkMediaLibrary.rest_nonce},body:JSON.stringify({enabled:d.enabled,max_size_mb:""===d.max_size_mb?0:Number(d.max_size_mb),message:d.message,image_id:d.image_id})}).then(e=>e.json()).then(e=>{if(l(!1),!e||!e.success)return void u((0,n.__)("Could not save upload limit settings. Please try again.","bubuku-media-library"));const t=J(e);t&&b(t),m((0,n.__)("Upload limit settings saved.","bubuku-media-library"))}).catch(()=>{l(!1),u((0,n.__)("A network error occurred while saving. Please try again.","bubuku-media-library"))})},disabled:a},a?(0,n.__)("Saving…","bubuku-media-library"):(0,n.__)("Save upload limit settings","bubuku-media-library"))))))},Q=()=>(0,r.createElement)("div",{className:"bbk-dashboard"},(0,r.createElement)(Z,null)),Y=(document.documentElement.lang||"en").toLowerCase();function ee(e,t){const a=new URLSearchParams({utm_source:"bml-plugin",utm_medium:"wp-admin-footer",utm_campaign:"bml-plugin-footer-links",utm_content:t+"-"+Y});return e+(e.includes("?")?"&":"?")+a.toString()}const te=[{href:ee("https://www.bubuku.com/blog/anadir-texto-alternativo-wordpress/","article-add-alt-text"),label:(0,n.__)("How to add alternative text to images in WordPress for better SEO and accessibility","bubuku-media-library")},{href:ee("https://www.bubuku.com/blog/alt-text-wpml-csv/","article-alt-text-csv-wpml"),label:(0,n.__)("How to export and import alternative text in WordPress with WPML and CSV files","bubuku-media-library")},{href:ee("https://www.bubuku.com/blog/cambiar-imagenes-wordpress/","article-update-images"),label:(0,n.__)("How to change or update images in WordPress without impacting performance","bubuku-media-library")},{href:ee("https://www.bubuku.com/blog/solucion-sizes-auto-wordpress/","article-sizes-auto"),label:(0,n.__)('How to solve problems with the sizes="auto" attribute in WordPress',"bubuku-media-library")},{href:ee("https://www.bubuku.com/blog/optimizacion-carga-imagenes-wordpress/","article-optimize-image-loading"),label:(0,n.__)("How to optimize image loading in WordPress for better performance and Core Web Vitals","bubuku-media-library")}],ae=[{label:(0,n.__)("Business-driven custom WordPress development","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"}))},{label:(0,n.__)("Plugins and external systems integrations","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),(0,r.createElement)("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"}))},{label:(0,n.__)("Continuous maintenance and support","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"23 4 23 10 17 10"}),(0,r.createElement)("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"}))},{label:(0,n.__)("Performance and conversion rate optimization","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"23 6 13.5 15.5 8.5 10.5 1 18"}),(0,r.createElement)("polyline",{points:"17 6 23 6 23 12"}))},{label:(0,n.__)("Technical implementation and integrations","bubuku-media-library"),icon:(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"12",cy:"12",r:"3"}),(0,r.createElement)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"}))}];function re(){return(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.createElement)("polyline",{points:"14 2 14 8 20 8"}),(0,r.createElement)("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),(0,r.createElement)("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),(0,r.createElement)("polyline",{points:"10 9 9 9 8 9"}))}function ie(){return(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"}))}function ne(){return(0,r.createElement)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},(0,r.createElement)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,r.createElement)("polyline",{points:"12 5 19 12 12 19"}))}const le=ee("https://www.bubuku.com/servicios/","cta-services"),se=function(){return(0,r.createElement)("footer",{className:"bk-footer-main"},(0,r.createElement)("div",{className:"bk-footer-main__inner"},(0,r.createElement)("div",{className:"bk-footer-main__resources"},(0,r.createElement)("div",{className:"bk-footer-main__section-title"},(0,r.createElement)("div",{className:"bk-footer-main__icon"},(0,r.createElement)(re,null)),(0,r.createElement)("p",{className:"bk-footer-main__heading"},(0,n.__)("Useful resources on image optimization (Spanish guides)","bubuku-media-library"))),(0,r.createElement)("p",{className:"bk-footer-main__description"},(0,n.__)("We've compiled some practical articles that can help you improve image loading and management in WordPress.","bubuku-media-library")),(0,r.createElement)("div",{className:"bk-footer-main__divider"}),(0,r.createElement)("ul",{className:"bk-footer-main__links"},te.map((e,t)=>(0,r.createElement)("li",{key:t},(0,r.createElement)(re,null),(0,r.createElement)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer"},e.label))))),(0,r.createElement)("div",{className:"bk-footer-main__team"},(0,r.createElement)("div",{className:"bk-footer-main__team-title"},(0,r.createElement)("div",{className:"bk-footer-main__icon"},(0,r.createElement)(ie,null)),(0,r.createElement)("p",{className:"bk-footer-main__team-heading"},(0,n.__)("Technical partner for your WordPress projects","bubuku-media-library"))),(0,r.createElement)("p",{className:"bk-footer-main__team-description"},(0,n.__)("We work alongside marketing and business teams to improve the stability, performance, and evolution of your WordPress projects.","bubuku-media-library")),(0,r.createElement)("ul",{className:"bk-footer-main__services"},ae.map((e,t)=>(0,r.createElement)("li",{key:t},e.icon,(0,r.createElement)("span",null,e.label)))),(0,r.createElement)("a",{href:le,target:"_blank",rel:"noopener noreferrer",className:"bk-footer-main__cta"},(0,n.__)("See how we work","bubuku-media-library"),(0,r.createElement)(ne,null)))))},oe=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,r.createElement)("path",{d:"M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4"}),(0,r.createElement)("path",{d:"M12 2v2"}),(0,r.createElement)("path",{d:"M9 12v9"}),(0,r.createElement)("path",{d:"M15 12v9"}),(0,r.createElement)("path",{d:"M5 16l4 -2"}),(0,r.createElement)("path",{d:"M15 14l4 2"}),(0,r.createElement)("path",{d:"M9 18h6"}),(0,r.createElement)("path",{d:"M10 8v.01"}),(0,r.createElement)("path",{d:"M14 8v.01"})),ue=({animationDelay:e=".18s",showManageAction:t=!1,onManageTools:a=null})=>{const i=BbkMediaLibrary&&BbkMediaLibrary.mcp_server_url?String(BbkMediaLibrary.mcp_server_url):"",l=BbkMediaLibrary&&BbkMediaLibrary.profile_app_passwords_url?String(BbkMediaLibrary.profile_app_passwords_url):"/wp-admin/profile.php#application-passwords-section",o=i.trim().length>0,[u,c]=wp.element.useState(""),m=`{\n "mcpServers": {\n "bubuku-media-library": {\n "command": "npx",\n "args": [\n "-y",\n "mcp-remote",\n "${i}",\n "--header",\n "Authorization: Basic BASE64_OF_USER_AND_APP_PASSWORD"\n ]\n }\n }\n}`,d=async(e,t)=>{if(e)try{await navigator.clipboard.writeText(e),c(t),window.setTimeout(()=>{c(e=>e===t?"":e)},1800)}catch(e){c("")}},b=(0,r.createElement)("span",{className:"bbk-mcp-header-status "+(o?"is-active":"is-inactive")},o?(0,n.__)("Active","bubuku-media-library"):(0,n.__)("Inactive","bubuku-media-library"));return(0,r.createElement)(s,{icon:(0,r.createElement)(oe,null),title:(0,n.__)("MCP Server","bubuku-media-library"),claim:(0,n.__)("Expose plugin abilities through one MCP server URL","bubuku-media-library"),headerMeta:b,animationDelay:e},(0,r.createElement)("div",{className:"bbk-agent-api-card"},(0,r.createElement)("div",{className:"bbk-mcp-url-block"},(0,r.createElement)("div",{className:"bbk-mcp-url-row"},(0,r.createElement)("span",{className:"bbk-mcp-url-value"},i||(0,n.__)("Unavailable","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>d(i,"server-url"),disabled:!i},"server-url"===u?(0,n.__)("Copied","bubuku-media-library"):(0,n.__)("Copy","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-mcp-divider","aria-hidden":"true"}),(0,r.createElement)("details",{className:"bbk-mcp-summary"},(0,r.createElement)("summary",null,(0,r.createElement)("span",{className:"bbk-mcp-summary-chevron","aria-hidden":"true"},(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},(0,r.createElement)("polyline",{points:"9 18 15 12 9 6"}))),(0,n.__)("Configure in Claude Desktop","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-mcp-summary__content"},(0,r.createElement)("ol",{className:"bbk-mcp-steps"},(0,r.createElement)("li",null,(0,r.createElement)("strong",null,(0,n.__)("Get your application password","bubuku-media-library")),(0,r.createElement)("span",null,(0,n.__)("Go to","bubuku-media-library")," ",(0,r.createElement)("a",{href:l,target:"_blank",rel:"noopener noreferrer"},(0,n.__)("Profile -> Application Passwords","bubuku-media-library"))," ",(0,n.__)("and create one for your WordPress user.","bubuku-media-library"))),(0,r.createElement)("li",null,(0,r.createElement)("strong",null,(0,n.__)("Encode credentials","bubuku-media-library")),(0,r.createElement)("span",null,(0,n.__)("Base64-encode","bubuku-media-library")," ",(0,r.createElement)("code",null,"username:app_password")," ",(0,n.__)("and replace","bubuku-media-library")," ",(0,r.createElement)("code",null,"BASE64_OF_USER_AND_APP_PASSWORD"),".")),(0,r.createElement)("li",null,(0,r.createElement)("strong",null,(0,n.__)("Add to claude_desktop_config.json","bubuku-media-library")),(0,r.createElement)("span",null,(0,n.__)("Requires","bubuku-media-library")," ",(0,r.createElement)("a",{href:"https://nodejs.org/",target:"_blank",rel:"noopener noreferrer"},(0,n.__)("Node.js","bubuku-media-library"))," ",(0,n.__)("- Claude Desktop uses","bubuku-media-library")," ",(0,r.createElement)("code",null,"mcp-remote")," ",(0,n.__)("via","bubuku-media-library")," ",(0,r.createElement)("code",null,"npx")," ",(0,n.__)("as a stdio bridge.","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-mcp-code-block"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>d(m,"snippet")},"snippet"===u?(0,n.__)("Copied","bubuku-media-library"):(0,n.__)("Copy","bubuku-media-library")),(0,r.createElement)("pre",null,(0,r.createElement)("code",null,m))),(0,r.createElement)("div",{className:"bbk-email-hint bbk-mcp-info-box"},(0,r.createElement)("p",null,(0,n.__)("This URL will return a 401 error when opened in a browser — that's normal, as it requires authenticated credentials.","bubuku-media-library"))))),t&&(0,r.createElement)("p",{className:"bbk-agent-api-card__action"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary",onClick:()=>{"function"==typeof a&&a()}},(0,n.__)("Manage per-tool abilities","bubuku-media-library")))))},ce={tools:[],roles:{}},me=e=>e&&e.success&&e.data?{tools:Array.isArray(e.data.tools)?e.data.tools:[],roles:e.data.roles&&"object"==typeof e.data.roles?e.data.roles:{}}:ce,de=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"9 18 15 12 9 6"})),be=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"11",cy:"11",r:"8"}),(0,r.createElement)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),he=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("polyline",{points:"20 6 9 17 4 12"})),pe=()=>(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.createElement)("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})),_e=({onToolsLoaded:e=null})=>{const[t,a]=(0,i.useState)(!0),[l,o]=(0,i.useState)(!1),[u,c]=(0,i.useState)(""),[m,d]=(0,i.useState)(""),[b,h]=(0,i.useState)(ce),[p,_]=(0,i.useState)(null),[k,f]=(0,i.useState)(""),y=(0,i.useMemo)(()=>{if(!k.trim())return b.tools;const e=k.toLowerCase();return b.tools.filter(t=>(t.label||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)||(t.description||"").toLowerCase().includes(e))},[b.tools,k]),g=(0,i.useMemo)(()=>b.tools.filter(e=>e?.setting?.enabled).length,[b.tools]),E=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/get-tools-settings`,[]),v=(0,i.useMemo)(()=>`${BbkMediaLibrary.api_url}/set-tools-settings`,[]);(0,i.useEffect)(()=>{fetch(E,{method:"GET",headers:{"X-WP-Nonce":BbkMediaLibrary.rest_nonce}}).then(e=>e.json()).then(t=>{const r=me(t);h(r),a(!1),e&&e(r.tools.length)}).catch(()=>{c((0,n.__)("Could not load tools settings. Please refresh and try again.","bubuku-media-library")),a(!1)})},[E]);const w=e=>_(t=>t===e?null:e);return(0,r.createElement)("div",{className:"bbk-tools-abilities-panel"},(0,r.createElement)(ue,{animationDelay:".06s"}),(0,r.createElement)(s,{title:(0,n.__)("Per-tool permissions","bubuku-media-library"),claim:(0,n.__)("Enable each tool and define the minimum role required to execute it.","bubuku-media-library"),icon:(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},(0,r.createElement)("path",{d:"M12 20h9"}),(0,r.createElement)("path",{d:"M12 4h9"}),(0,r.createElement)("path",{d:"M4 9h16"}),(0,r.createElement)("path",{d:"M4 15h16"}),(0,r.createElement)("path",{d:"M5 4v16"}))},t&&(0,r.createElement)("p",{className:"bbk-tools-placeholder"},(0,n.__)("Loading tools settings...","bubuku-media-library")),!t&&u&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--error"},u),!t&&m&&(0,r.createElement)("div",{className:"bbk-notice bbk-notice--success"},m),!t&&!u&&0===b.tools.length&&(0,r.createElement)("p",{className:"bbk-tools-placeholder"},(0,n.__)("No tools were discovered. Check your tools loader configuration.","bubuku-media-library")),!t&&b.tools.length>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"bbk-tools-toolbar"},(0,r.createElement)("div",{className:"bbk-tools-search-wrap"},(0,r.createElement)(be,null),(0,r.createElement)("input",{type:"search",className:"bbk-tools-search",placeholder:(0,n.__)("Search tools by name or slug...","bubuku-media-library"),value:k,onChange:e=>f(e.target.value)})),(0,r.createElement)("div",{className:"bbk-tools-toolbar-actions"},(0,r.createElement)("span",{className:"bbk-tools-enabled-count"},g," ",(0,n.__)("of","bubuku-media-library")," ",b.tools.length," ",(0,n.__)("enabled","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>{h(e=>({...e,tools:e.tools.map(e=>({...e,setting:{...e.setting,enabled:!0}}))}))}},(0,r.createElement)(he,null),(0,n.__)("Enable all","bubuku-media-library")),(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-secondary bk-btn-sm",onClick:()=>{h(e=>({...e,tools:e.tools.map(e=>({...e,setting:{...e.setting,enabled:!1}}))}))}},(0,r.createElement)(pe,null),(0,n.__)("Disable all","bubuku-media-library")))),(0,r.createElement)("div",{className:"bbk-tools-table-wrap"},(0,r.createElement)("table",{className:"bbk-tools-table"},(0,r.createElement)("thead",null,(0,r.createElement)("tr",null,(0,r.createElement)("th",{className:"bbk-tools-col-expand"}),(0,r.createElement)("th",null,(0,n.__)("Tool","bubuku-media-library")),(0,r.createElement)("th",{className:"bbk-tools-col-help"},(0,n.__)("Help","bubuku-media-library")),(0,r.createElement)("th",{className:"bbk-tools-col-role"},(0,n.__)("Minimum role","bubuku-media-library")),(0,r.createElement)("th",{className:"bbk-tools-col-enabled"},(0,n.__)("Enabled","bubuku-media-library")))),(0,r.createElement)("tbody",null,0===y.length?(0,r.createElement)("tr",null,(0,r.createElement)("td",{colSpan:5,className:"bbk-tools-no-results"},(0,n.__)("No tools match your search.","bubuku-media-library"))):null,y.map(e=>{const t=Boolean(e?.setting?.enabled),a=p===e.name,i=e?.setting?.role||"editor",l=`tool-${String(e.name).replace(/[^a-zA-Z0-9_-]/g,"-")}`,s=e.help?.criteria||e.help?.examples?.length>0;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("tr",{key:e.name,className:t?"":"is-disabled"},(0,r.createElement)("td",{className:"bbk-tools-col-expand"},s&&(0,r.createElement)("button",{type:"button",className:"bbk-tools-expand-btn"+(a?" is-open":""),onClick:()=>w(e.name),"aria-label":a?(0,n.__)("Collapse","bubuku-media-library"):(0,n.__)("Expand","bubuku-media-library"),"aria-expanded":a},(0,r.createElement)(de,null))),(0,r.createElement)("td",null,(0,r.createElement)("strong",null,e.label),e.description&&(0,r.createElement)("p",{className:"bbk-tools-info-desc"},e.description)),(0,r.createElement)("td",{className:"bbk-tools-col-help"},s&&(0,r.createElement)("button",{type:"button",className:"bbk-tools-help-btn"+(a?" is-active":""),onClick:()=>w(e.name),"aria-label":(0,n.__)("Help","bubuku-media-library")},"?")),(0,r.createElement)("td",{className:"bbk-tools-col-role"},(0,r.createElement)("select",{value:i,onChange:t=>{return a=e.name,r=t.target.value,void h(e=>({...e,tools:e.tools.map(e=>e.name===a?{...e,setting:{...e.setting,role:r}}:e)}));var a,r}},Object.entries(b.roles).map(([e,t])=>(0,r.createElement)("option",{key:e,value:e},t))),!1===e.meets_capability_floor&&(0,r.createElement)("p",{className:"bbk-tools-role-warning",title:(0,n.__)("This tool always requires a minimum WordPress capability at runtime, regardless of the role selected here. The saved role is not being changed automatically.","bubuku-media-library")},(0,n.__)("⚠ Below this tool's required capability — it will still enforce it.","bubuku-media-library"))),(0,r.createElement)("td",{className:"bbk-tools-col-enabled"},(0,r.createElement)("label",{className:"bbk-tools-toggle",htmlFor:l},(0,r.createElement)("input",{id:l,type:"checkbox",checked:t,onChange:t=>{return a=e.name,r=t.target.checked,void h(e=>({...e,tools:e.tools.map(e=>e.name===a?{...e,setting:{...e.setting,enabled:r}}:e)}));var a,r}})))),a&&(0,r.createElement)("tr",{key:`${e.name}-info`,className:"bbk-tools-info-row"},(0,r.createElement)("td",{colSpan:"5"},(0,r.createElement)("div",{className:"bbk-tools-info-panel"},(e.help?.criteria||e.help?.examples?.length>0)&&(0,r.createElement)("div",{className:"bbk-tools-info-layout"},e.help?.criteria&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"bbk-tools-info-label"},(0,n.__)("When to use","bubuku-media-library")),(0,r.createElement)("p",{className:"bbk-tools-info-criteria"},e.help.criteria)),e.help?.examples?.length>0&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"bbk-tools-info-label"},(0,n.__)("Example prompts","bubuku-media-library")),(0,r.createElement)("div",{className:"bbk-tools-examples-list"},e.help.examples.map((t,a)=>(0,r.createElement)("div",{key:`${e.name}-ex-${a}`,className:"bbk-tools-example"},t)))))))))}))))),!t&&b.tools.length>0&&(0,r.createElement)("div",{className:"bbk-tools-actions"},(0,r.createElement)("button",{type:"button",className:"bk-btn bk-btn-primary",onClick:()=>{o(!0),c(""),d("");const e=b.tools.reduce((e,t)=>(e[t.name]={enabled:t.setting?.enabled?1:0,role:t.setting?.role||"editor"},e),{});fetch(v,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":BbkMediaLibrary.rest_nonce},body:JSON.stringify({settings:e})}).then(e=>e.json()).then(e=>{o(!1),e&&e.success?(h(me(e)),d(e?.data?.message||(0,n.__)("Tools settings saved.","bubuku-media-library"))):c((0,n.__)("Could not save tools settings. Please try again.","bubuku-media-library"))}).catch(()=>{o(!1),c((0,n.__)("A network error occurred while saving. Please try again.","bubuku-media-library"))})},disabled:l},l?(0,n.__)("Saving...","bubuku-media-library"):(0,n.__)("Save tools settings","bubuku-media-library")))))},ke="overview",fe="export-import",ye="settings",ge="tools-abilities",Ee=ke,ve=[{id:ke,label:(0,n.__)("Overview","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))},{id:fe,label:(0,n.__)("Export/Import","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5M16.5 3 21 7.5m0 0L16.5 12M21 7.5H7.5"}))},{id:ye,label:(0,n.__)("Settings","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 0 1 0 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.216.456a1.125 1.125 0 0 1-1.37-.49l-1.296-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 0 1 0-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.369-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281Z"}),(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))},{id:ge,label:(0,n.__)("Tools & Abilities","bubuku-media-library"),icon:()=>(0,r.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","aria-hidden":"true"},(0,r.createElement)("path",{d:"M12 8V4H8"}),(0,r.createElement)("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),(0,r.createElement)("path",{d:"M2 14h2"}),(0,r.createElement)("path",{d:"M20 14h2"}),(0,r.createElement)("path",{d:"M15 13v2"}),(0,r.createElement)("path",{d:"M9 13v2"}))}],we=()=>{const e=new URLSearchParams(window.location.search).get("tab");return ve.some(t=>t.id===e)?e:Ee},Ne=function(){const[e,t]=(0,i.useState)(()=>we()),[a,s]=(0,i.useState)(0);(0,i.useEffect)(()=>{const e=()=>{t(we())};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)}},[]);return(0,r.createElement)("div",{className:"bk-app"},(0,r.createElement)(l,null),(0,r.createElement)("div",{className:"bbk-admin-tabs",role:"tablist","aria-label":(0,n.__)("Bubuku Settings","bubuku-media-library")},ve.map(({id:i,label:n,icon:l})=>(0,r.createElement)("button",{key:i,type:"button",role:"tab","aria-selected":e===i,className:"bbk-admin-tab "+(e===i?"is-active":""),onClick:()=>{return t(e=i),void(e=>{const t=new URL(window.location.href);e===Ee?t.searchParams.delete("tab"):t.searchParams.set("tab",e),window.history.replaceState({},"",`${t.pathname}${t.search}`)})(e);var e}},(0,r.createElement)(l,null),n,i===ge&&a>0&&(0,r.createElement)("span",{className:"bbk-admin-tab__badge"},a)))),(0,r.createElement)("div",{role:"tabpanel"},e===ke&&(0,r.createElement)(v,null),e===fe&&(0,r.createElement)(q,null),e===ye&&(0,r.createElement)(Q,null),e===ge&&(0,r.createElement)(_e,{onToolsLoaded:s})),(0,r.createElement)(se,null))};document.addEventListener("DOMContentLoaded",function(){const e=document.getElementById("bbk-media-library-app");null!=e&&(0,i.createRoot)(e).render((0,r.createElement)(Ne,null))})},901(){},809(e,t){var a,r;a=function e(){var t,a="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==a?a:{},r=!a.document&&!!a.postMessage,i=a.IS_PAPA_WORKER||!1,n={},l=0,s={};function o(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=y(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new b(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,t){var r=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<r){let t=this._config.newline;t||(n=this._config.quoteChar||'"',t=this._handle.guessLineEndings(e,n)),e=[...e.split(t).slice(r)].join(t)}this.isFirstChunk&&E(this._config.beforeFirstChunk)&&void 0!==(n=this._config.beforeFirstChunk(e))&&(e=n),this.isFirstChunk=!1,this._halted=!1,r=this._partialLine+e;var n=(this._partialLine="",this._handle.parse(r,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(e=n.meta.cursor,this._finished||(this._partialLine=r.substring(e-this._baseIndex),this._baseIndex=e),n&&n.data&&(this._rowCount+=n.data.length),r=this._finished||this._config.preview&&this._rowCount>=this._config.preview,i)a.postMessage({results:n,workerId:s.WORKER_ID,finished:r});else if(E(this._config.chunk)&&!t){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=n=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!r||!E(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),r||n&&n.meta.paused||this._nextChunk(),n}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):i&&this._config.error&&a.postMessage({workerId:s.WORKER_ID,error:e,finished:!1})}}function u(e){var t;(e=e||{}).chunkSize||(e.chunkSize=s.RemoteChunkSize),o.call(this,e),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),r||(t.onload=g(this._chunkLoaded,this),t.onerror=g(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var e,a=this._config.downloadRequestHeaders;for(e in a)t.setRequestHeader(e,a[e])}var i;this._config.chunkSize&&(i=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+i));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}r&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(e=>null!==(e=e.getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1)(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(new Error(e))}}function c(e){(e=e||{}).chunkSize||(e.chunkSize=s.LocalChunkSize),o.call(this,e);var t,a,r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,a=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=g(this._chunkLoaded,this),t.onerror=g(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input,i=(this._config.chunkSize&&(i=Math.min(this._start+this._config.chunkSize,this._input.size),e=a.call(e,this._start,i)),t.readAsText(e,this._config.encoding));r||this._chunkLoaded({target:{result:i}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function m(e){var t;o.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,a;if(!this._finished)return e=this._config.chunkSize,t=e?(a=t.substring(0,e),t.substring(e)):(a=t,""),this._finished=!t,this.parseChunk(a)}}function d(e){o.call(this,e=e||{});var t=[],a=!0,r=!1;this.pause=function(){o.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){o.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):a=!0},this._streamData=g(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),a&&(a=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=g(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=g(function(){this._streamCleanUp(),r=!0,this._streamData("")},this),this._streamCleanUp=g(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function b(e){var t,a,r,i,n=Math.pow(2,53),l=-n,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,u=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,c=this,m=0,d=0,b=!1,_=!1,k=[],f={data:[],errors:[],meta:{}};function g(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function v(){if(f&&r&&(N("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines&&(f.data=f.data.filter(function(e){return!g(e)})),w()){if(f)if(Array.isArray(f.data[0])){for(var t=0;w()&&t<f.data.length;t++)f.data[t].forEach(a);f.data.splice(0,1)}else f.data.forEach(a);function a(t,a){E(e.transformHeader)&&(t=e.transformHeader(t,a)),k.push(t)}}function i(t,a){for(var r=e.header?{}:[],i=0;i<t.length;i++){var s=i,c=t[i];c=((t,a)=>(t=>(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping)))(t)?"true"===a||"TRUE"===a||"false"!==a&&"FALSE"!==a&&((e=>{if(o.test(e)&&(e=parseFloat(e),l<e&&e<n))return 1})(a)?parseFloat(a):u.test(a)?new Date(a):""===a?null:a):a)(s=e.header?i>=k.length?"__parsed_extra":k[i]:s,c=e.transform?e.transform(c,s):c),"__parsed_extra"===s?(r[s]=r[s]||[],r[s].push(c)):r[s]=c}return e.header&&(i>k.length?N("FieldMismatch","TooManyFields","Too many fields: expected "+k.length+" fields but parsed "+i,d+a):i<k.length&&N("FieldMismatch","TooFewFields","Too few fields: expected "+k.length+" fields but parsed "+i,d+a)),r}var c;f&&(e.header||e.dynamicTyping||e.transform)&&(c=1,!f.data.length||Array.isArray(f.data[0])?(f.data=f.data.map(i),c=f.data.length):f.data=i(f.data,0),e.header&&f.meta&&(f.meta.fields=k),d+=c)}function w(){return e.header&&0===k.length}function N(e,t,a,r){e={type:e,code:t,message:a},void 0!==r&&(e.row=r),f.errors.push(e)}E(e.step)&&(i=e.step,e.step=function(t){f=t,w()?v():(v(),0!==f.data.length&&(m+=t.data.length,e.preview&&m>e.preview?a.abort():(f.data=f.data[0],i(f,c))))}),this.parse=function(i,n,l){var o=e.quoteChar||'"';return e.newline||(e.newline=this.guessLineEndings(i,o)),r=!1,e.delimiter?E(e.delimiter)&&(e.delimiter=e.delimiter(i),f.meta.delimiter=e.delimiter):((o=((t,a,r,i,n)=>{var l,o,u,c;n=n||[",","\t","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var m=0;m<n.length;m++){for(var d,b=n[m],h=0,_=0,k=0,f=(u=void 0,new p({comments:i,delimiter:b,newline:a,preview:10}).parse(t)),y=0;y<f.data.length;y++)r&&g(f.data[y])?k++:(_+=d=f.data[y].length,void 0===u?u=d:0<d&&(h+=Math.abs(d-u),u=d));0<f.data.length&&(_/=f.data.length-k),(void 0===o||h<=o)&&(void 0===c||c<_)&&1.99<_&&(o=h,l=b,c=_)}return{successful:!!(e.delimiter=l),bestDelimiter:l}})(i,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess)).successful?e.delimiter=o.bestDelimiter:(r=!0,e.delimiter=s.DefaultDelimiter),f.meta.delimiter=e.delimiter),o=y(e),e.preview&&e.header&&o.preview++,t=i,a=new p(o),f=a.parse(t,n,l),v(),b?{meta:{paused:!0}}:f||{meta:{paused:!1}}},this.paused=function(){return b},this.pause=function(){b=!0,a.abort(),t=E(e.chunk)?"":t.substring(a.getCharIndex())},this.resume=function(){c.streamer._halted?(b=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return _},this.abort=function(){_=!0,a.abort(),f.meta.aborted=!0,E(e.complete)&&e.complete(f),t=""},this.guessLineEndings=function(e,t){e=e.substring(0,1048576),t=new RegExp(h(t)+"([^]*?)"+h(t),"gm");var a=(e=e.replace(t,"")).split("\r");if(e=1<(t=e.split("\n")).length&&t[0].length<a[0].length,1===a.length||e)return"\n";for(var r=0,i=0;i<a.length;i++)"\n"===a[i][0]&&r++;return r>=a.length/2?"\r\n":"\r"}}function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function p(e){var t=(e=e||{}).delimiter,a=e.newline,r=e.comments,i=e.step,n=e.preview,l=e.fastMode,o=null,u=!1,c=null==e.quoteChar?'"':e.quoteChar,m=c;if(void 0!==e.escapeChar&&(m=e.escapeChar),("string"!=typeof t||-1<s.BAD_DELIMITERS.indexOf(t))&&(t=","),r===t)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<s.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==a&&"\r"!==a&&"\r\n"!==a&&(a="\n");var d=0,b=!1;this.parse=function(s,p,_){if("string"!=typeof s)throw new Error("Input must be a string");var k=s.length,f=t.length,y=a.length,g=r.length,v=E(i),w=[],N=[],x=[],C=d=0;if(!s)return B();if(l||!1!==l&&-1===s.indexOf(c)){for(var S=s.split(a),L=0;L<S.length;L++){if(x=S[L],d+=x.length,L!==S.length-1)d+=a.length;else if(_)return B();if(!r||x.substring(0,g)!==r){if(v){if(w=[],A(x.split(t)),j(),b)return B()}else A(x.split(t));if(n&&n<=L)return w=w.slice(0,n),B(!0)}}return B()}for(var M=s.indexOf(t,d),T=s.indexOf(a,d),D=new RegExp(h(m)+h(c),"g"),R=s.indexOf(c,d);;)if(s[d]===c)for(R=d,d++;;){if(-1===(R=s.indexOf(c,R+1)))return _||N.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:w.length,index:d}),I();if(R===k-1)return I(s.substring(d,R).replace(D,c));if(c===m&&s[R+1]===m)R++;else if(c===m||0===R||s[R-1]!==m){-1!==M&&M<R+1&&(M=s.indexOf(t,R+1));var z=O(-1===(T=-1!==T&&T<R+1?s.indexOf(a,R+1):T)?M:Math.min(M,T));if(s.substr(R+1+z,f)===t){x.push(s.substring(d,R).replace(D,c)),s[d=R+1+z+f]!==c&&(R=s.indexOf(c,d)),M=s.indexOf(t,d),T=s.indexOf(a,d);break}if(z=O(T),s.substring(R+1+z,R+1+z+y)===a){if(x.push(s.substring(d,R).replace(D,c)),P(R+1+z+y),M=s.indexOf(t,d),R=s.indexOf(c,d),v&&(j(),b))return B();if(n&&w.length>=n)return B(!0);break}N.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:d}),R++}}else if(r&&0===x.length&&s.substring(d,d+g)===r){if(-1===T)return B();d=T+y,T=s.indexOf(a,d),M=s.indexOf(t,d)}else if(-1!==M&&(M<T||-1===T))x.push(s.substring(d,M)),d=M+f,M=s.indexOf(t,d);else{if(-1===T)break;if(x.push(s.substring(d,T)),P(T+y),v&&(j(),b))return B();if(n&&w.length>=n)return B(!0)}return I();function A(e){w.push(e),C=d}function O(e){return-1!==e&&(e=s.substring(R+1,e))&&""===e.trim()?e.length:0}function I(e){return _||(void 0===e&&(e=s.substring(d)),x.push(e),d=k,A(x),v&&j()),B()}function P(e){d=e,A(x),x=[],T=s.indexOf(a,d)}function B(r){if(e.header&&!p&&w.length&&!u){var i=w[0],n=Object.create(null),l=new Set(i);let t=!1;for(let a=0;a<i.length;a++){let r=i[a];if(n[r=E(e.transformHeader)?e.transformHeader(r,a):r]){let e,s=n[r];for(;e=r+"_"+s,s++,l.has(e););l.add(e),i[a]=e,n[r]++,t=!0,(o=null===o?{}:o)[e]=r}else n[r]=1,i[a]=r;l.add(r)}t&&console.warn("Duplicate headers found and renamed."),u=!0}return{data:w,errors:N,meta:{delimiter:t,linebreak:a,aborted:b,truncated:!!r,cursor:C+(p||0),renamedHeaders:o}}}function j(){i(B()),w=[],N=[]}},this.abort=function(){b=!0},this.getCharIndex=function(){return d}}function _(e){var t=e.data,a=n[t.workerId],r=!1;if(t.error)a.userError(t.error,t.file);else if(t.results&&t.results.data){var i={abort:function(){r=!0,k(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:f,resume:f};if(E(a.userStep)){for(var l=0;l<t.results.data.length&&(a.userStep({data:t.results.data[l],errors:t.results.errors,meta:t.results.meta},i),!r);l++);delete t.results}else E(a.userChunk)&&(a.userChunk(t.results,i,t.file),delete t.results)}t.finished&&!r&&k(t.workerId,t.results)}function k(e,t){var a=n[e];E(a.userComplete)&&a.userComplete(t),a.terminate(),delete n[e]}function f(){throw new Error("Not implemented.")}function y(e){if("object"!=typeof e||null===e)return e;var t,a=Array.isArray(e)?[]:{};for(t in e)a[t]=y(e[t]);return a}function g(e,t){return function(){e.apply(t,arguments)}}function E(e){return"function"==typeof e}return s.parse=function(t,r){var i=(r=r||{}).dynamicTyping||!1;if(E(i)&&(r.dynamicTypingFunction=i,i={}),r.dynamicTyping=i,r.transform=!!E(r.transform)&&r.transform,!r.worker||!s.WORKERS_SUPPORTED)return i=null,s.NODE_STREAM_INPUT,"string"==typeof t?(t=(e=>65279!==e.charCodeAt(0)?e:e.slice(1))(t),i=new(r.download?u:m)(r)):!0===t.readable&&E(t.read)&&E(t.on)?i=new d(r):(a.File&&t instanceof File||t instanceof Object)&&(i=new c(r)),i.stream(t);(i=(()=>{var t;return!!s.WORKERS_SUPPORTED&&(t=(()=>{var t=a.URL||a.webkitURL||null,r=e.toString();return s.BLOB_URL||(s.BLOB_URL=t.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",r,")();"],{type:"text/javascript"})))})(),(t=new a.Worker(t)).onmessage=_,t.id=l++,n[t.id]=t)})()).userStep=r.step,i.userChunk=r.chunk,i.userComplete=r.complete,i.userError=r.error,r.step=E(r.step),r.chunk=E(r.chunk),r.complete=E(r.complete),r.error=E(r.error),delete r.worker,i.postMessage({input:t,config:r,workerId:i.id})},s.unparse=function(e,t){var a=!1,r=!0,i=",",n="\r\n",l='"',o=l+l,u=!1,c=null,m=!1,d=((()=>{if("object"==typeof t){if("string"!=typeof t.delimiter||s.BAD_DELIMITERS.filter(function(e){return-1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),"boolean"!=typeof t.quotes&&"function"!=typeof t.quotes&&!Array.isArray(t.quotes)||(a=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(u=t.skipEmptyLines),"string"==typeof t.newline&&(n=t.newline),"string"==typeof t.quoteChar&&(l=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(o=t.escapeChar+l),t.escapeFormulae instanceof RegExp?m=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(m=/^[=+\-@\t\r].*$/)}})(),new RegExp(h(l),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return b(null,e,u);if("object"==typeof e[0])return b(c||Object.keys(e[0]),e,u)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||c),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),b(e.fields||[],e.data||[],u);throw new Error("Unable to serialize unrecognized input");function b(e,t,a){var l="",s=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0<e.length),o=!Array.isArray(t[0]);if(s&&r){for(var u=0;u<e.length;u++)0<u&&(l+=i),l+=p(e[u],u);0<t.length&&(l+=n)}for(var c=0;c<t.length;c++){var m=(s?e:t[c]).length,d=!1,b=s?0===Object.keys(t[c]).length:0===t[c].length;if(a&&!s&&(d="greedy"===a?""===t[c].join("").trim():1===t[c].length&&0===t[c][0].length),"greedy"===a&&s){for(var h=[],_=0;_<m;_++){var k=o?e[_]:_;h.push(t[c][k])}d=""===h.join("").trim()}if(!d){for(var f=0;f<m;f++){0<f&&!b&&(l+=i);var y=s&&o?e[f]:f;l+=p(t[c][y],f)}c<t.length-1&&(!a||0<m&&!b)&&(l+=n)}}return l}function p(e,t){var r,n;return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(n=!1,m&&"string"==typeof e&&m.test(e)&&(e="'"+e,n=!0),r=e.toString().replace(d,o),(n=n||!0===a||"function"==typeof a&&a(e,t)||Array.isArray(a)&&a[t]||((e,t)=>{for(var a=0;a<t.length;a++)if(-1<e.indexOf(t[a]))return!0;return!1})(r,s.BAD_DELIMITERS)||-1<r.indexOf(i)||" "===r.charAt(0)||" "===r.charAt(r.length-1))?l+r+l:r)}},s.RECORD_SEP=String.fromCharCode(30),s.UNIT_SEP=String.fromCharCode(31),s.BYTE_ORDER_MARK="\ufeff",s.BAD_DELIMITERS=["\r","\n",'"',s.BYTE_ORDER_MARK],s.WORKERS_SUPPORTED=!r&&!!a.Worker,s.NODE_STREAM_INPUT=1,s.LocalChunkSize=10485760,s.RemoteChunkSize=5242880,s.DefaultDelimiter=",",s.Parser=p,s.ParserHandle=b,s.NetworkStreamer=u,s.FileStreamer=c,s.StringStreamer=m,s.ReadableStreamStreamer=d,a.jQuery&&((t=a.jQuery).fn.parse=function(e){var r=e.config||{},i=[];return this.each(function(e){if("INPUT"!==t(this).prop("tagName").toUpperCase()||"file"!==t(this).attr("type").toLowerCase()||!a.FileReader||!this.files||0===this.files.length)return!0;for(var n=0;n<this.files.length;n++)i.push({file:this.files[n],inputElem:this,instanceConfig:t.extend({},r)})}),n(),this;function n(){if(0===i.length)E(e.complete)&&e.complete();else{var a,r,n,o=i[0];if(E(e.before)){var u=e.before(o.file,o.inputElem);if("object"==typeof u){if("abort"===u.action)return a=o.file,r=o.inputElem,n=u.reason,void(E(e.error)&&e.error({name:"AbortError"},a,r,n));if("skip"===u.action)return void l();"object"==typeof u.config&&(o.instanceConfig=t.extend(o.instanceConfig,u.config))}else if("skip"===u)return void l()}var c=o.instanceConfig.complete;o.instanceConfig.complete=function(e){E(c)&&c(e,o.file,o.inputElem),l()},s.parse(o.file,o.instanceConfig)}}function l(){i.splice(0,1),n()}}),i&&(a.onmessage=function(e){e=e.data,void 0===s.WORKER_ID&&e&&(s.WORKER_ID=e.workerId),"string"==typeof e.input?a.postMessage({workerId:s.WORKER_ID,results:s.parse(e.input,e.config),finished:!0}):(a.File&&e.input instanceof File||e.input instanceof Object)&&(e=s.parse(e.input,e.config))&&a.postMessage({workerId:s.WORKER_ID,results:e,finished:!0})}),(u.prototype=Object.create(o.prototype)).constructor=u,(c.prototype=Object.create(o.prototype)).constructor=c,(m.prototype=Object.create(m.prototype)).constructor=m,(d.prototype=Object.create(o.prototype)).constructor=d,s},void 0===(r=a.apply(t,[]))||(e.exports=r)}},a={};function r(e){var i=a[e];if(void 0!==i)return i.exports;var n=a[e]={exports:{}};return t[e].call(n.exports,n,n.exports,r),n.exports}r.m=t,e=[],r.O=(t,a,i,n)=>{if(!a){var l=1/0;for(c=0;c<e.length;c++){for(var[a,i,n]=e[c],s=!0,o=0;o<a.length;o++)(!1&n||l>=n)&&Object.keys(r.O).every(e=>r.O[e](a[o]))?a.splice(o--,1):(s=!1,n<l&&(l=n));if(s){e.splice(c--,1);var u=i();void 0!==u&&(t=u)}}return t}n=n||0;for(var c=e.length;c>0&&e[c-1][2]>n;c--)e[c]=e[c-1];e[c]=[a,i,n]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={884:0,15:0};r.O.j=t=>0===e[t];var t=(t,a)=>{var i,n,[l,s,o]=a,u=0;if(l.some(t=>0!==e[t])){for(i in s)r.o(s,i)&&(r.m[i]=s[i]);if(o)var c=o(r)}for(t&&t(a);u<l.length;u++)n=l[u],r.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return r.O(c)},a=globalThis.webpackChunkbubuku_media_library=globalThis.webpackChunkbubuku_media_library||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})(),r.O(void 0,[15],()=>r(651));var i=r.O(void 0,[15],()=>r(901));i=r.O(i)})(); -
bubuku-media-library/trunk/assets/build/style-admin.css
r3741020 r3751624 1 #bbk-media-library-app{--primary:#239295;--primary-dark:#1f8288;--accent:#ffc629;--accent-dark:#e8a100;--text:#132633;--text-light:#22394a;--text-muted:#54707e;--border:#dce7f0;--border-strong:#c3d4e0;--background:#eff4f8;--surface:#fff;--bg-cool:#e7f3f3;--green-500:#1f9d6b;--green-600:#177a52;--red-500:#d1503c;--green-100:#ecfdf5;--green-300:#a7d9c4;--green-700:#065f46;--red-100:#fef2f2;--red-300:#f3b4ab;--red-700:#7f1d1d;--amber-100:#fff3ce;--amber-700:#92400e;--shadow-pluma:0 1px 2px rgba(19,38,51,.06),0 2px 8px rgba(19,38,51,.05);--shadow-profunda:0 4px 12px rgba(19,38,51,.08),0 32px 64px -16px rgba(31,130,136,.22);--shadow-panel:0 0 0 1px rgba(19,38,51,.06),0 16px 48px -12px rgba(19,38,51,.18);--radius-button:8px;--radius-medium:10px;--radius-large:16px;--focus-ring:0 0 0 3px rgba(35,146,149,.2);--transition-fast:150ms cubic-bezier(0.3,0,0.2,1);--transition-base:280ms cubic-bezier(0.3,0,0.2,1);--code-bg:#eaf0f5;--brand:var(--primary);--brand-hover:var(--primary-dark);--brand-soft:var(--bg-cool);--cta:var(--accent);--cta-hover:var(--accent-dark);--cta-ink:var(--text);--bg-page:var(--background);--surface-card:var(--surface);--surface-sunken:var(--background);--text-heading:var(--text);--text-body:var(--text-light);--text-invert:var(--surface);--border-card:var(--border)}@keyframes bk-fadeDown{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes bk-fadeUp{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes bk-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.bk-btn{align-items:center;border:none;border-radius:var(--radius-button);cursor:pointer;display:flex;font-size:.9;font-weight:500;gap:7px;padding:13px 18px;text-decoration:none;transition:all .15s;white-space:nowrap}.bk-btn:active{transform:translateY(0)}.bk-btn:disabled{cursor:not-allowed;opacity:.6;pointer-events:none}.bk-btn.bk-btn-primary{background:var(--brand);box-shadow:0 2px 8px rgba(35,146,149,.25);color:var(--text-invert)}.bk-btn.bk-btn-primary:hover{background:var(--brand-hover);box-shadow:0 4px 12px rgba(35,146,149,.35);transform:translateY(-1px)}.bk-btn.bk-btn-secondary{background:transparent;border:1px solid rgba(35,146,149,.35);color:var(--brand)}.bk-btn.bk-btn-secondary:hover{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-hover)}.bk-btn.bk-btn-success{background:var(--green-500);box-shadow:0 2px 8px rgba(31,157,107,.25);color:var(--text-invert)}.bk-btn.bk-btn-success:hover{background:var(--green-600);box-shadow:0 4px 12px rgba(31,157,107,.35);transform:translateY(-1px)}.bbk-notice{align-items:center;border-radius:var(--radius-button);display:flex;font-size:.85rem;gap:10px;margin:0;padding:10px 14px}.bbk-notice svg{flex-shrink:0}.bbk-notice--green-500{background:var(--green-100);border:1.5px solid var(--green-300);color:var(--green-700)}.bbk-notice--error{background:var(--red-100);border:1.5px solid var(--red-300);color:var(--red-700)}.b k-app{margin:0 auto;max-width:1180px}.bbk-admin-tabs{border-bottom:1px solid var(--border-card);display:flex;flex-wrap:wrap;margin:0 0 24px}.bbk-admin-tab{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:none;border-bottom:4px solid transparent;border-top-left-radius:6px;border-top-right-radius:6px;color:var(--text-muted);cursor:pointer;display:inline-flex;font-size:13px;font-weight:500;gap:6px;margin-bottom:-1px;padding:10px 16px;transition:color .15s ease,border-color .15s ease,background .15s ease}.bbk-admin-tab svg{flex-shrink:0;height:20px;width:20px}.bbk-admin-tab.is-active,.bbk-admin-tab:hover{color:var(--text-heading)}.bbk-admin-tab.is-active{background:var(--surface-card);border-bottom-color:var(--cta);font-weight:600}.bbk-admin-tab.is-active .bbk-admin-tab__badge{background:var(--cta);color:var(--cta-ink);opacity:1;transition:background .15s ease,opacity .15s ease}.bbk-admin-tab__badge{align-items:center;background:var(--text-muted);border-radius:9px;color:var(--text-invert);display:inline-flex;font-size:11px;font-weight:700;height:18px;justify-content:center;line-height:1;min-width:18px;opacity:.4;padding:0 5px}.bk-header-main{align-items:center;animation:bk-fadeDown .5s ease both;display:flex;gap:16px;margin-bottom:36px}.bk-header-main .bk-icon{align-items:center;background:var(--brand);border-radius:var(--radius-button);box-shadow:0 4px 12px rgba(35,146,149,.3);display:flex;flex-shrink:0;height:48px;justify-content:center;width:48px}.bk-header-main .bk-icon svg{color:var(--text-invert)}.bk-header-main .bk-title{color:var(--text-heading);font-size:22px;font-weight:600;letter-spacing:-.3px;margin:0;padding:0}.bk-header-main .bk-title span{color:var(--brand)}.bk-header-main .bk-subtitle{color:var(--text-muted);font-size:13.5px;margin:0}.bk-dashboard-card{animation:bk-fadeUp .5s ease both;background:var(--surface-card);border:1px solid var(--border-card);border-radius:var(--radius-large);box-shadow:var(--shadow-pluma);margin-bottom:16px;overflow:hidden;padding:0}.bk-dashboard-card .card-header{align-items:flex-start;border-bottom:1px solid var(--border-card);display:flex;gap:12px;justify-content:space-between;padding:20px 24px}.bk-dashboard-card .card-header-main{align-items:center;display:flex;gap:12px;min-width:0}.bk-dashboard-card .card-header-meta{flex-shrink:0}.bk-dashboard-card .card-header-icon{align-items:center;border-radius:8px;display:flex;flex-shrink:0;height:36px;justify-content:center;width:36px}.bk-dashboard-card .card-header-icon.icon-accent{background:var(--brand-soft);color:var(--brand)}.bk-dashboard-card .card-header-icon.icon-success{background:var(--green-100);color:var(--green-500)}.bk-dashboard-card .card-header-icon.icon-warning{background:var(--amber-100);color:var(--amber-700)}.bk-dashboard-card .card-header-text h2{color:var(--text-heading);font-size:14.5px;font-weight:600;letter-spacing:-.1px;margin:0}.bk-dashboard-card .card-header-text p{color:var(--text-muted);font-size:12.5px;margin-bottom:0;margin-top:1px}.bk-dashboard-card .card-body{padding:24px}.bk-card-footer{display:flex;flex-direction:column;gap:12px;margin-top:16px}.bk-card-footer .bk-btn{justify-content:center;width:100%}@media screen and (min-width:600px){.bk-card-footer{align-items:flex-end;flex-direction:row}.bk-card-footer .bk-card-footer__info{flex:1;min-width:0}.bk-card-footer .bk-btn{flex-shrink:0;margin-left:auto;width:25%}}.bk-card-footer__info{display:flex;flex-direction:column;gap:8px;min-width:0}.bbk-summary-grid{display:grid;gap:16px;grid-template-columns:1fr;margin-bottom:16px}@media screen and (min-width:960px){.bbk-summary-grid{grid-template-columns:1fr 1fr}}.bbk-size-summary{display:flex;flex-direction:column;gap:14px}.bbk-size-tiles{display:grid;gap:10px;grid-template-columns:repeat(3,1fr)}.bbk-size-tile{align-items:center;border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;flex-direction:column;padding:10px 8px;text-align:center}.bbk-size-tile__number{font-size:22px;font-weight:700;line-height:1.1}.bbk-size-tile__label{color:var(--text-muted);font-size:11px;line-height:1.3;margin-top:4px;text-transform:uppercase}.bbk-size-tile--good{background:var(--green-100);border-color:var(--green-500)}.bbk-size-tile--good .bbk-size-tile__number{color:var(--green-500)}.bbk-size-tile--medium{background:var(--amber-100);border-color:var(--amber-700)}.bbk-size-tile--medium .bbk-size-tile__number{color:var(--amber-700)}.bbk-size-tile--bad{background:var(--red-100);border-color:var(--red-500)}.bbk-size-tile--bad .bbk-size-tile__number{color:var(--red-500)}.bbk-size-bar__track{background:var(--border-card);border-radius:6px;display:flex;height:6px;overflow:hidden}.bbk-size-bar__segment{height:100%;transition:flex .4s ease}.bbk-size-bar__segment--good{background:var(--green-500)}.bbk-size-bar__segment--medium{background:var(--amber-700)}.bbk-size-bar__segment--bad{background:var(--red-500)}.bbk-size-bar__footer{display:flex;justify-content:space-between;margin-top:6px}.bbk-size-bar__total{color:var(--text-muted);font-size:11px}.bbk-size-bar__total strong{color:var(--text-heading)}.bbk-size-bar__attention{color:var(--red-500);font-size:11px;font-weight:500}.bbk-summary-alt-chart{align-items:center;display:flex;gap:24px;padding:8px 0}.bbk-summary-alt-chart__donut{flex-shrink:0}.bbk-summary-alt-chart__donut circle{transition:stroke-dashoffset .5s ease}.bbk-summary-alt-chart__legend{display:flex;flex-direction:column;gap:8px}.bbk-summary-alt-chart__legend-item{align-items:center;color:var(--text-heading);display:flex;font-size:13px;gap:8px}.bbk-summary-alt-chart__legend-dot{border-radius:50%;flex-shrink:0;height:10px;width:10px}.bbk-summary-alt-chart__legend-dot--missing{background:var(--red-500)}.bbk-summary-alt-chart__legend-dot--present{background:var(--green-500)}.bbk-summary-alt-chart__legend-value{font-weight:700;margin-left:auto;padding-left:16px}.bbk-summary-note{color:var(--text-muted);font-size:12px;margin-top:16px;text-align:center}.bbk-summary-skeleton{display:flex;flex-direction:column;gap:10px;padding:4px 0}.bbk-summary-skeleton__line{animation:bk-skeleton-shimmer 1.4s infinite;background:linear-gradient(90deg,var(--border-card) 25%,var(--surface-card) 50%,var(--border-card) 75%);background-size:200% 100%;border-radius:4px;height:14px}.bbk-summary-skeleton__line--short{width:40%}.bbk-summary-skeleton__line--medium{width:65%}.bbk-summary-skeleton__line--full{width:100%}.bbk-email-notifications{display:flex;flex-direction:column;gap:0}.bbk-email-notifications .form-row{display:flex;flex-direction:column;gap:10px;padding:16px 0}.bbk-email-notifications .form-row:first-of-type{padding-top:0}.bbk-email-notifications .form-row--separated{border-top:1px solid var(--border-card);padding-bottom:0}.bbk-email-notifications .form-row__label{display:flex;flex-direction:column;gap:2px}.bbk-email-notifications .form-row__title{color:var(--text-heading);font-size:13.5px;font-weight:600}.bbk-email-notifications .form-row__help{color:var(--text-muted);font-size:12px}.bbk-email-notifications .form-row__control{flex:1}.bbk-email-notifications .form-row__control input[type=text],.bbk-email-notifications .form-row__control select{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);font-size:13.5px;height:40px;padding:0 12px;transition:border-color .15s;width:100%}.bbk-email-notifications .form-row__control input[type=text]:focus,.bbk-email-notifications .form-row__control select:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-email-notifications .form-row__control input[type=text]:disabled,.bbk-email-notifications .form-row__control select:disabled{cursor:not-allowed;opacity:.6}.bbk-email-hint{align-items:flex-start;border-left:3px solid var(--brand);display:flex;gap:10px;margin-top:18px;padding:10px 14px}.bbk-email-hint svg{color:var(--brand);flex-shrink:0;margin-top:1px}.bbk-email-hint p{color:var(--text-muted);font-size:12.5px;line-height:1.6;margin:0}@media screen and (min-width:600px){.bbk-email-notifications .form-row{align-items:center;flex-direction:row;gap:16px}.bbk-email-notifications .form-row__label{flex-shrink:0;width:160px}}.form-feedback{align-items:center;border-radius:var(--radius-button);display:flex;font-size:12.5px;gap:10px;margin:0;padding:10px 14px}.form-feedback svg{flex-shrink:0}.form-feedback--green-500{background:var(--green-100);border:1.5px solid var(--green-300);color:var(--green-700)}.form-feedback--error{background:var(--red-100);border:1.5px solid var(--red-300);color:var(--red-700)}.bbk-send-test{border-top:1px solid var(--border-card);margin-top:20px;padding-top:20px}.bbk-send-test__header{display:flex;flex-direction:column;gap:2px;margin-bottom:12px}.bbk-send-test__title{color:var(--text-heading);font-size:13.5px;font-weight:600}.bbk-send-test__help{color:var(--text-muted);font-size:12px}.bbk-send-test__row{align-items:center;display:flex;gap:8px}.bbk-send-test__input{box-sizing:border-box;flex:1;height:40px;padding:0 12px;transition:border-color .15s}.bbk-send-test__input,.bbk-send-test__input[type=text]{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);color:var(--text-heading);font-size:13.5px}.bbk-send-test__input[type=text]{box-shadow:none}.bbk-send-test__input:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-send-test__input:disabled{cursor:not-allowed;opacity:.6}.bbk-send-test__feedback{margin-top:8px}.bbk-preview-url{align-items:center;color:var(--text-muted);display:flex;font-size:12px;gap:8px;margin-top:12px}.bbk-preview-url__label{flex-shrink:0}.bbk-preview-url__link{color:var(--brand);font-weight:600;text-decoration:none}.bbk-preview-url__link:hover{text-decoration:underline}.bbk-mcp-header-status{align-items:center;border-radius:999px;display:inline-flex;font-size:12px;font-weight:600;line-height:1;padding:3px 10px}.bbk-mcp-header-status.is-active{background:var(--green-100);color:var(--green-700)}.bbk-mcp-header-status.is-inactive{background:var(--red-100);color:var(--red-700)}.bbk-agent-api-card{display:flex;flex-direction:column;gap:14px}.bbk-agent-api-card .bbk-mcp-url-block{display:flex;flex-direction:column;gap:8px}.bbk-agent-api-card .bbk-mcp-url-label{color:var(--text-muted);font-size:12px;font-weight:600;letter-spacing:.05em;margin:0;text-transform:uppercase}.bbk-agent-api-card .bbk-mcp-url-row{align-items:center;background:var(--code-bg);border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;gap:8px;padding:10px 12px}.bbk-agent-api-card .bbk-mcp-url-value{color:var(--text-heading);flex:1;font-size:12.5px;line-height:1.45;min-width:0;word-break:break-all}.bbk-agent-api-card .bbk-mcp-divider{background:var(--border-card);height:1px}.bbk-agent-api-card .bbk-mcp-summary{background:var(--surface-card);border:1px solid var(--border-card);border-radius:var(--radius-button);overflow:hidden}.bbk-agent-api-card .bbk-mcp-summary summary{align-items:center;background:var(--surface-sunken);border-bottom:1px solid transparent;color:var(--text-heading);cursor:pointer;display:flex;font-size:13px;font-weight:600;gap:8px;list-style:none;padding:11px 12px}.bbk-agent-api-card .bbk-mcp-summary summary::-webkit-details-marker{display:none}.bbk-agent-api-card .bbk-mcp-summary summary .bbk-mcp-summary-chevron{color:var(--text-muted);display:inline-flex;line-height:1}.bbk-agent-api-card .bbk-mcp-summary summary .bbk-mcp-summary-chevron svg{display:block;transition:transform .2s}.bbk-agent-api-card .bbk-mcp-summary[open] summary{border-bottom-color:var(--border-card)}.bbk-agent-api-card .bbk-mcp-summary[open] summary .bbk-mcp-summary-chevron svg{transform:rotate(90deg)}.bbk-agent-api-card .bbk-mcp-summary .bbk-mcp-summary__content{background:var(--surface-sunken);border-top:1px solid var(--border-card);display:flex;flex-direction:column;gap:10px;padding:12px}.bbk-agent-api-card .bbk-mcp-config-block{display:flex;flex-direction:column;gap:10px}.bbk-agent-api-card .bbk-mcp-config-title{color:var(--text-muted);font-size:12px;font-weight:600;letter-spacing:.05em;margin:0;text-transform:uppercase}.bbk-agent-api-card .bbk-mcp-steps{display:flex;flex-direction:column;gap:10px;list-style:none;margin:0;padding-left:0}.bbk-agent-api-card .bbk-mcp-steps li{-moz-column-gap:10px;column-gap:10px;display:grid;grid-template-columns:24px 1fr;row-gap:2px}.bbk-agent-api-card .bbk-mcp-steps li:before{align-items:center;background:var(--surface-card);border:1px solid var(--border-card);border-radius:50%;color:var(--text-muted);content:counter(bbk-mcp-step);counter-increment:bbk-mcp-step;display:inline-flex;font-size:11px;font-weight:700;height:20px;justify-content:center;margin-top:1px;width:20px}.bbk-agent-api-card .bbk-mcp-steps{counter-reset:bbk-mcp-step}.bbk-agent-api-card .bbk-mcp-steps span,.bbk-agent-api-card .bbk-mcp-steps strong{grid-column:2}.bbk-agent-api-card .bbk-mcp-steps strong{color:var(--text-heading);font-size:13px;font-weight:600}.bbk-agent-api-card .bbk-mcp-steps span{color:var(--text-muted);font-size:12.5px;line-height:1.5}.bbk-agent-api-card .bbk-mcp-code-block{background:var(--code-bg);border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;flex-direction:column;gap:8px;padding:10px}.bbk-agent-api-card .bbk-mcp-code-block .bk-btn{align-self:flex-end}.bbk-agent-api-card .bbk-mcp-code-block pre{background:none;border:none;margin:0;overflow-x:auto;padding:0}.bbk-agent-api-card .bbk-mcp-code-block code{font-size:12px;line-height:1.5;white-space:pre}.bbk-agent-api-card .bbk-mcp-info-box{align-items:flex-start;background:var(--amber-100);border-left:3px solid var(--amber-700);margin-top:2px;padding:10px 14px}.bbk-agent-api-card .bbk-mcp-info-box p{font-size:12.5px;line-height:1.6;margin:0}.bbk-agent-api-card p{color:var(--text-muted);font-size:13px;margin:0}.bbk-agent-api-card p code{font-size:12px}.bbk-agent-api-card .bbk-notice{margin-top:2px}.bbk-agent-api-card__action{margin-top:6px}.bbk-agent-api-card__action .bk-btn{justify-content:center;width:100%}@media screen and (min-width:600px){.bbk-agent-api-card__action .bk-btn{width:auto}}@media screen and (max-width:640px){.bbk-agent-api-card .bbk-mcp-url-row{align-items:stretch;flex-direction:column}.bbk-agent-api-card .bbk-mcp-code-block .bk-btn,.bbk-agent-api-card .bbk-mcp-url-row .bk-btn{justify-content:center;width:100%}}.bbk-tools-abilities-panel .bk-dashboard-card{margin-bottom:16px}.bbk-tools-placeholder{color:var(--text-muted);font-size:13px;margin:0}.bbk-tools-toolbar{align-items:center;display:flex;flex-wrap:wrap;gap:12px;justify-content:space-between;margin-bottom:12px}.bbk-tools-search-wrap{flex:1;min-width:200px;position:relative}.bbk-tools-search-wrap svg{color:var(--text-muted);left:10px;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%)}.bbk-tools-search-wrap input[type=search].bbk-tools-search{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-shadow:none;box-sizing:border-box;color:var(--text-heading);font-size:13px;height:32px;outline:none;padding:0 12px 0 34px;transition:border-color .15s;width:100%}.bbk-tools-search-wrap input[type=search].bbk-tools-search:focus{border-color:var(--brand);box-shadow:var(--focus-ring)}.bbk-tools-search-wrap input[type=search].bbk-tools-search::-webkit-search-cancel-button{display:none}.bbk-tools-toolbar-actions{align-items:center;display:flex;flex-shrink:0;gap:8px}.bbk-tools-enabled-count{color:var(--text-muted);font-size:12px;padding:0 4px;white-space:nowrap}.bbk-tools-no-results{color:var(--text-muted);font-size:13px;padding:20px 12px;text-align:center}.bk-btn-sm{font-size:12px;gap:5px;padding:6px 12px}.bk-btn-sm svg{height:13px;width:13px}.bbk-tools-table-wrap{border:1px solid var(--border-card);border-radius:var(--radius-button);overflow-x:auto}.bbk-tools-table{border-collapse:collapse;min-width:700px;width:100%}.bbk-tools-table thead th{background:var(--surface-sunken);border-bottom:1px solid var(--border-card);color:var(--text-muted);font-size:12px;letter-spacing:.4px;padding:11px 12px;text-align:left;text-transform:uppercase}.bbk-tools-table thead th.bbk-tools-col-expand{padding:11px 8px;width:40px}.bbk-tools-table thead th.bbk-tools-col-help{text-align:center;width:60px}.bbk-tools-table thead th.bbk-tools-col-role{width:160px}.bbk-tools-table thead th.bbk-tools-col-enabled{text-align:center;width:80px}.bbk-tools-table tbody td{border-bottom:1px solid var(--border-card);font-size:13px;padding:12px;vertical-align:middle}.bbk-tools-table tbody td.bbk-tools-col-expand{padding:12px 8px}.bbk-tools-table tbody td.bbk-tools-col-enabled,.bbk-tools-table tbody td.bbk-tools-col-help{text-align:center}.bbk-tools-table tbody tr.is-disabled td{opacity:.58}.bbk-tools-table .bbk-tools-role-warning{color:var(--amber-700);font-size:11px;line-height:1.3;margin:6px 0 0}.bbk-tools-table select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--surface-card);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 fill=%27none%27 stroke=%27%23485a69%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272.5%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27m6 9 6 6 6-6%27/%3E%3C/svg%3E");background-position:right 8px center;background-repeat:no-repeat;border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);cursor:pointer;font-size:13px;height:32px;padding:0 28px 0 10px;transition:border-color .15s;width:100%}.bbk-tools-table select:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-tools-toggle{cursor:pointer;display:inline-block;height:24px;position:relative;vertical-align:middle;width:44px}.bbk-tools-toggle input{cursor:pointer;height:100%;inset:0;margin:0;opacity:0;position:absolute;width:100%;z-index:1}.bbk-tools-toggle:before{background:var(--border-strong);border-radius:12px;content:"";inset:0;position:absolute;transition:background .2s}.bbk-tools-toggle:after{background:var(--surface-card);border-radius:50%;box-shadow:0 1px 3px rgba(0,0,0,.2);content:"";height:20px;left:2px;position:absolute;top:2px;transition:transform .2s;width:20px}.bbk-tools-toggle:has(input:checked):before{background:var(--brand)}.bbk-tools-toggle:has(input:checked):after{transform:translateX(20px)}.bbk-tools-expand-btn{align-items:center;background:none;border:none;border-radius:4px;color:var(--text-muted);cursor:pointer;display:inline-flex;justify-content:center;line-height:1;padding:4px}.bbk-tools-expand-btn svg{display:block;transition:transform .2s}.bbk-tools-expand-btn.is-open svg{transform:rotate(90deg)}.bbk-tools-expand-btn:hover{color:var(--brand)}.bbk-tools-help-btn{align-items:center;background:var(--surface-sunken);border:1px solid var(--border-card);border-radius:50%;color:var(--text-muted);cursor:pointer;display:inline-flex;font-size:13px;font-weight:700;height:22px;justify-content:center;line-height:1;padding:0;transition:background .15s,color .15s,border-color .15s;width:22px}.bbk-tools-help-btn.is-active,.bbk-tools-help-btn:hover{background:var(--brand);border-color:var(--brand);color:var(--text-invert)}.bbk-tools-table tbody tr:has(+.bbk-tools-info-row)>td:first-child{border-left:3px solid var(--brand)}.bbk-tools-info-row td{border-bottom:1px solid var(--border-card);border-left:3px solid var(--brand);padding:0}.bbk-tools-info-panel{background:var(--surface-sunken);padding:16px 20px}.bbk-tools-info-desc{color:var(--text-heading);font-size:13px;margin:0}.bbk-tools-info-layout{align-items:start;display:grid;gap:10px 24px;grid-template-columns:140px 1fr}.bbk-tools-info-label{color:var(--brand);font-size:11px;font-weight:700;letter-spacing:.6px;padding-top:2px;text-transform:uppercase}.bbk-tools-info-criteria{color:var(--text-heading);font-size:13px;line-height:1.5;margin:0}.bbk-tools-examples-list{display:flex;flex-direction:column;gap:4px}.bbk-tools-example{align-items:flex-start;color:var(--text-heading);display:flex;font-size:12px;gap:8px;padding:3px 0}.bbk-tools-example:before{color:var(--brand);content:">_";flex-shrink:0;font-family:monospace;font-size:11px;font-style:normal;font-weight:600;padding-top:1px}.bbk-tools-actions{display:flex;justify-content:flex-end;margin-top:16px}.bbk-upload-limit-card,.bbk-upload-limit-layout{display:flex;flex-direction:column;gap:20px}@media screen and (min-width:960px){.bbk-upload-limit-layout{align-items:start;display:grid;gap:20px 28px;grid-template-areas:"toggle size" "message preview" "image preview";grid-template-columns:1.2fr 1fr}}.bbk-upload-limit-row--toggle{align-items:flex-start;display:flex;gap:14px}@media screen and (min-width:960px){.bbk-upload-limit-row--toggle{grid-area:toggle}.bbk-upload-limit-field--size{align-items:flex-end;grid-area:size;justify-self:end;max-width:260px;text-align:right}.bbk-upload-limit-field--message{grid-area:message}.bbk-upload-limit-field--image{grid-area:image}.bbk-upload-limit-field--preview{grid-area:preview;height:100%}.bbk-upload-limit-row--toggle{-ms-grid-column:1;-ms-grid-row:1}.bbk-upload-limit-field--size{-ms-grid-column:3;-ms-grid-row:1}.bbk-upload-limit-field--message{-ms-grid-column:1;-ms-grid-row:3}.bbk-upload-limit-field--image{-ms-grid-column:1;-ms-grid-row:5}.bbk-upload-limit-field--preview{-ms-grid-row:3;-ms-grid-row-span:3;-ms-grid-column:3}}.bbk-upload-limit-row-text strong{color:var(--text-heading);display:block;font-size:13px;margin-bottom:2px}.bbk-upload-limit-row-text p{color:var(--text-muted);font-size:12px;margin:0}.bbk-upload-limit-field{display:flex;flex-direction:column;gap:6px}.bbk-upload-limit-field>.bbk-upload-limit-field-label,.bbk-upload-limit-field>label{color:var(--text-heading);font-size:13px;font-weight:600}.bbk-upload-limit-field-header{align-items:center;display:flex;gap:12px;justify-content:space-between}.bbk-upload-limit-hint{color:var(--text-muted);font-size:11px;margin:0}.bbk-upload-limit-max-size-input{align-items:center;display:flex;gap:8px;max-width:160px}.bbk-upload-limit-max-size-input input[type=number]{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);flex:1;font-size:13px;height:32px;padding:0 10px}.bbk-upload-limit-max-size-input input[type=number]:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-upload-limit-max-size-input input[type=number]:disabled{cursor:not-allowed;opacity:.6}.bbk-upload-limit-max-size-input span{color:var(--text-muted);font-size:12px}.bbk-upload-limit-message-input{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:1.5;min-height:140px;padding:10px 12px;resize:vertical;width:100%}.bbk-upload-limit-message-input:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-upload-limit-message-input:disabled{cursor:not-allowed;opacity:.6}.bbk-upload-limit-image-preview img{border:1px solid var(--border-card);border-radius:var(--radius-button);display:block;height:auto;max-height:160px;max-width:240px;width:auto}.bbk-upload-limit-image-actions{display:flex;gap:8px}.bbk-upload-limit-mock-overlay{align-items:center;background:rgba(0,0,0,.55);border-radius:var(--radius-button);box-sizing:border-box;display:flex;justify-content:center;padding:24px}@media screen and (min-width:960px){.bbk-upload-limit-mock-overlay{height:100%}}.bbk-upload-limit-mock-dialog{background:#fff;border-radius:10px;box-shadow:0 20px 50px rgba(0,0,0,.3);box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;padding:28px 28px 24px;position:relative;width:100%}.bbk-upload-limit-mock-close{color:#50575e;font-size:20px;height:32px;line-height:32px;position:absolute;right:12px;text-align:center;top:12px;width:32px}.bbk-upload-limit-mock-title{color:#1d2327;font-size:18px;font-weight:600;margin:0 28px 14px 0}.bbk-upload-limit-mock-body{color:#1d2327;font-size:14px;line-height:1.6}.bbk-upload-limit-mock-body a{color:#2271b1}.bbk-upload-limit-mock-body strong{font-weight:600}.bbk-upload-limit-mock-files{background:#f6f7f7;border-radius:6px;font-size:13px;list-style:disc;list-style-position:inside;margin:14px 0 0;padding:10px 14px}.bbk-upload-limit-mock-files li{word-break:break-all}.bbk-upload-limit-mock-file-size{color:var(--red-700);font-weight:700}.bbk-upload-limit-mock-image{border:1px solid #dcdcde;border-radius:6px;display:block;height:auto;margin-top:16px;max-width:100%}.upload-zone{background:var(--surface-card);border:2px dashed var(--border-card);border-radius:var(--radius-button);cursor:pointer;padding:28px;position:relative;text-align:center;transition:all .2s}.upload-zone.upload-zone--dragging,.upload-zone:hover{background:var(--brand-soft);border-color:var(--brand)}.upload-zone input[type=file]{cursor:pointer;height:100%;inset:0;opacity:0;position:absolute;width:100%}.upload-zone p{color:var(--text-muted);font-size:13px}.upload-zone p strong{color:var(--brand);font-weight:500}.upload-zone .upload-hint{color:var(--text-muted);font-size:11.5px;margin-top:4px}.upload-zone-icon{align-items:center;background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:8px;box-shadow:var(--shadow-pluma);color:var(--text-muted);display:flex;height:40px;justify-content:center;margin:0 auto 10px;width:40px}.file-selected{align-items:center;background:var(--green-100);border:1.5px solid var(--green-300);border-radius:var(--radius-button);color:var(--green-700);display:flex;gap:10px;padding:10px 14px}.file-selected span{font-size:.85rem;font-weight:500}.file-selected .file-name{font-size:.75rem}.bk-export-form{display:flex;flex-direction:column;gap:16px}.bk-filters-grid{display:grid;gap:16px;grid-template-columns:1fr 1fr}@media(max-width:600px){.bk-filters-grid{grid-template-columns:1fr}}.bk-filter-group{display:flex;flex-direction:column;gap:8px}.bk-filter-label{color:var(--text-muted);font-size:12.5px;font-weight:500}.bk-chip-group{display:flex;flex-wrap:wrap;gap:6px}.bk-chip{align-items:center;background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:20px;color:var(--text-muted);cursor:pointer;display:inline-flex;font-size:12.5px;font-weight:500;gap:6px;line-height:1;padding:5px 12px;transition:border-color .15s,background .15s,color .15s}.bk-chip.bk-chip--active,.bk-chip:hover{border-color:var(--brand);color:var(--brand)}.bk-chip.bk-chip--active{background:var(--brand-soft)}.bk-chip.bk-chip--good.bk-chip--active{background:var(--green-100);border-color:var(--green-500);color:var(--green-500)}.bk-chip.bk-chip--mid.bk-chip--active{background:var(--amber-100);border-color:var(--amber-700);color:var(--amber-700)}.bk-chip.bk-chip--bad.bk-chip--active{background:var(--red-100);border-color:var(--red-500);color:var(--red-500)}.bk-size-dot{border-radius:50%;display:inline-block;flex-shrink:0;height:8px;width:8px}.bk-size-dot.bk-size-dot--good{background:var(--green-500)}.bk-size-dot.bk-size-dot--mid{background:var(--amber-700)}.bk-size-dot.bk-size-dot--bad{background:var(--red-500)}.bk-size-legend{background:var(--surface-sunken);border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;flex-wrap:wrap;gap:20px;padding:12px 16px}.bk-size-legend__item{align-items:center;color:var(--text-muted);display:flex;font-size:12.5px;gap:5px}.bk-size-legend__label{font-weight:600;margin-right:2px}.bk-size-legend__label.bk-size-legend__label--good{color:var(--green-500)}.bk-size-legend__label.bk-size-legend__label--mid{color:var(--amber-700)}.bk-size-legend__label.bk-size-legend__label--bad{color:var(--red-500)}.bk-export-count{color:var(--text-muted);font-size:13px;margin:0}.bk-export-count strong{color:var(--text-heading);font-weight:600}.bk-footer-main{animation:bk-fadeUp .5s ease both;border-top:1px solid var(--border-card);margin-top:48px;padding-top:40px}.bk-footer-main__inner{background:var(--surface-card);border:1px solid var(--border-card);border-radius:var(--radius-large);box-shadow:var(--shadow-pluma);display:grid;gap:48px;grid-template-columns:60fr 40fr;padding:36px 40px}.bk-footer-main__icon{align-items:center;background:var(--brand-soft);border-radius:var(--radius-button);display:flex;flex-shrink:0;height:32px;justify-content:center;width:32px}.bk-footer-main__icon svg{fill:none;height:16px;stroke:var(--brand);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:16px}.bk-footer-main__section-title{align-items:center;display:flex;gap:12px;margin-bottom:10px}.bk-footer-main__heading{color:var(--text-heading);font-size:14px;font-weight:600;line-height:1.4;margin:0}.bk-footer-main__heading span{color:var(--text-muted);font-weight:400}.bk-footer-main__description{color:var(--text-muted);font-size:13px;line-height:1.6;margin-bottom:20px;padding-left:44px}.bk-footer-main__divider{background:var(--border-card);height:1px;margin:0 0 16px 44px}.bk-footer-main__links{display:flex;flex-direction:column;gap:10px;list-style:none;margin:0;padding-left:44px}.bk-footer-main__links li{align-items:flex-start;display:flex;gap:8px}.bk-footer-main__links li svg{fill:none;flex-shrink:0;height:13px;margin-top:2px;opacity:.55;stroke:var(--brand);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:13px}.bk-footer-main__links a{color:var(--brand);font-size:13px;line-height:1.45;text-decoration:none;transition:color .15s}.bk-footer-main__links a:hover{color:var(--brand-hover);text-decoration:underline}.bk-footer-main__links a code{background:var(--brand-soft);border-radius:4px;font-family:monospace;font-size:12px;padding:1px 4px}.bk-footer-main__team{border-left:1px solid var(--border-card);padding-left:40px}.bk-footer-main__team-title{align-items:flex-start;display:flex;gap:12px;margin-bottom:10px}.bk-footer-main__team-heading{color:var(--text-heading);font-size:14px;font-weight:600;line-height:1.4;margin:0}.bk-footer-main__team-description{color:var(--text-muted);font-size:13px;line-height:1.6;margin-bottom:20px}.bk-footer-main__services{display:flex;flex-direction:column;gap:9px;list-style:none;margin:0 0 24px;padding:0}.bk-footer-main__services li{align-items:flex-start;color:var(--text-heading);display:flex;font-size:13px;gap:9px;line-height:1.4}.bk-footer-main__services li svg{fill:none;flex-shrink:0;height:14px;opacity:.7;stroke:var(--brand);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:14px}.bk-footer-main__cta{align-items:center;border:1px solid rgba(35,146,149,.35);border-radius:var(--radius-button);color:var(--brand);display:inline-flex;font-size:13px;font-weight:500;gap:6px;padding:9px 18px;text-decoration:none;transition:background .15s,border-color .15s,color .15s}.bk-footer-main__cta:hover{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-hover)}.bk-footer-main__cta svg{fill:none;height:13px;stroke:currentcolor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2;width:13px}@media(max-width:780px){.bk-footer-main__inner{grid-template-columns:1fr}.bk-footer-main__team{border-left:none;border-top:1px solid var(--border-card);padding-left:0;padding-top:28px}}#wpcontent{padding-left:0}ul#adminmenu a.wp-has-current-submenu:after,ul#adminmenu>li.current>a.current:after{border-right-color:#eff4f8}#wpbody-content{padding-bottom:0}#wpbody-content>.wrap{margin:0;padding:0}#wpbody-content>.notice,#wpfooter,.notice.notice-warning.update-nag,.wp-core-ui .notice.is-dismissible{display:none!important}#bbk-media-library-app{background:var(--bg-page);border-bottom:4px solid var(--border-card);color:var(--text-heading);line-height:1.5;min-height:100vh;padding:40px 24px}1 #bbk-media-library-app{--primary:#239295;--primary-dark:#1f8288;--accent:#ffc629;--accent-dark:#e8a100;--text:#132633;--text-light:#22394a;--text-muted:#54707e;--border:#dce7f0;--border-strong:#c3d4e0;--background:#eff4f8;--surface:#fff;--bg-cool:#e7f3f3;--green-500:#1f9d6b;--green-600:#177a52;--red-500:#d1503c;--green-100:#ecfdf5;--green-300:#a7d9c4;--green-700:#065f46;--red-100:#fef2f2;--red-300:#f3b4ab;--red-700:#7f1d1d;--amber-100:#fff3ce;--amber-700:#92400e;--shadow-pluma:0 1px 2px rgba(19,38,51,.06),0 2px 8px rgba(19,38,51,.05);--shadow-profunda:0 4px 12px rgba(19,38,51,.08),0 32px 64px -16px rgba(31,130,136,.22);--shadow-panel:0 0 0 1px rgba(19,38,51,.06),0 16px 48px -12px rgba(19,38,51,.18);--radius-button:8px;--radius-medium:10px;--radius-large:16px;--focus-ring:0 0 0 3px rgba(35,146,149,.2);--transition-fast:150ms cubic-bezier(0.3,0,0.2,1);--transition-base:280ms cubic-bezier(0.3,0,0.2,1);--code-bg:#eaf0f5;--brand:var(--primary);--brand-hover:var(--primary-dark);--brand-soft:var(--bg-cool);--cta:var(--accent);--cta-hover:var(--accent-dark);--cta-ink:var(--text);--bg-page:var(--background);--surface-card:var(--surface);--surface-sunken:var(--background);--text-heading:var(--text);--text-body:var(--text-light);--text-invert:var(--surface);--border-card:var(--border)}@keyframes bk-fadeDown{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes bk-fadeUp{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes bk-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.bk-btn{align-items:center;border:none;border-radius:var(--radius-button);cursor:pointer;display:flex;font-size:.9;font-weight:500;gap:7px;padding:13px 18px;text-decoration:none;transition:all .15s;white-space:nowrap}.bk-btn:active{transform:translateY(0)}.bk-btn:disabled{cursor:not-allowed;opacity:.6;pointer-events:none}.bk-btn.bk-btn-primary{background:var(--brand);box-shadow:0 2px 8px rgba(35,146,149,.25);color:var(--text-invert)}.bk-btn.bk-btn-primary:hover{background:var(--brand-hover);box-shadow:0 4px 12px rgba(35,146,149,.35);transform:translateY(-1px)}.bk-btn.bk-btn-secondary{background:transparent;border:1px solid rgba(35,146,149,.35);color:var(--brand)}.bk-btn.bk-btn-secondary:hover{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-hover)}.bk-btn.bk-btn-success{background:var(--green-500);box-shadow:0 2px 8px rgba(31,157,107,.25);color:var(--text-invert)}.bk-btn.bk-btn-success:hover{background:var(--green-600);box-shadow:0 4px 12px rgba(31,157,107,.35);transform:translateY(-1px)}.bbk-notice{align-items:center;border-radius:var(--radius-button);display:flex;font-size:.85rem;gap:10px;margin:0;padding:10px 14px}.bbk-notice svg{flex-shrink:0}.bbk-notice--green-500{background:var(--green-100);border:1.5px solid var(--green-300);color:var(--green-700)}.bbk-notice--error{background:var(--red-100);border:1.5px solid var(--red-300);color:var(--red-700)}.bbk-notice--success{background:var(--green-100);border:1.5px solid var(--green-300);color:var(--green-700)}.bk-app{margin:0 auto;max-width:1180px}.bbk-admin-tabs{border-bottom:1px solid var(--border-card);display:flex;flex-wrap:wrap;margin:0 0 24px}.bbk-admin-tab{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:none;border-bottom:4px solid transparent;border-top-left-radius:6px;border-top-right-radius:6px;color:var(--text-muted);cursor:pointer;display:inline-flex;font-size:13px;font-weight:500;gap:6px;margin-bottom:-1px;padding:10px 16px;transition:color .15s ease,border-color .15s ease,background .15s ease}.bbk-admin-tab svg{flex-shrink:0;height:20px;width:20px}.bbk-admin-tab.is-active,.bbk-admin-tab:hover{color:var(--text-heading)}.bbk-admin-tab.is-active{background:var(--surface-card);border-bottom-color:var(--cta);font-weight:600}.bbk-admin-tab.is-active .bbk-admin-tab__badge{background:var(--cta);color:var(--cta-ink);opacity:1;transition:background .15s ease,opacity .15s ease}.bbk-admin-tab__badge{align-items:center;background:var(--text-muted);border-radius:9px;color:var(--text-invert);display:inline-flex;font-size:11px;font-weight:700;height:18px;justify-content:center;line-height:1;min-width:18px;opacity:.4;padding:0 5px}.bk-header-main{align-items:center;animation:bk-fadeDown .5s ease both;display:flex;gap:16px;margin-bottom:36px}.bk-header-main .bk-icon{align-items:center;background:var(--brand);border-radius:var(--radius-button);box-shadow:0 4px 12px rgba(35,146,149,.3);display:flex;flex-shrink:0;height:48px;justify-content:center;width:48px}.bk-header-main .bk-icon svg{color:var(--text-invert)}.bk-header-main .bk-title{color:var(--text-heading);font-size:22px;font-weight:600;letter-spacing:-.3px;margin:0;padding:0}.bk-header-main .bk-title span{color:var(--brand)}.bk-header-main .bk-subtitle{color:var(--text-muted);font-size:13.5px;margin:0}.bk-dashboard-card{animation:bk-fadeUp .5s ease both;background:var(--surface-card);border:1px solid var(--border-card);border-radius:var(--radius-large);box-shadow:var(--shadow-pluma);margin-bottom:16px;overflow:hidden;padding:0}.bk-dashboard-card .card-header{align-items:flex-start;border-bottom:1px solid var(--border-card);display:flex;gap:12px;justify-content:space-between;padding:20px 24px}.bk-dashboard-card .card-header-main{align-items:center;display:flex;gap:12px;min-width:0}.bk-dashboard-card .card-header-meta{flex-shrink:0}.bk-dashboard-card .card-header-icon{align-items:center;border-radius:8px;display:flex;flex-shrink:0;height:36px;justify-content:center;width:36px}.bk-dashboard-card .card-header-icon.icon-accent{background:var(--brand-soft);color:var(--brand)}.bk-dashboard-card .card-header-icon.icon-success{background:var(--green-100);color:var(--green-500)}.bk-dashboard-card .card-header-icon.icon-warning{background:var(--amber-100);color:var(--amber-700)}.bk-dashboard-card .card-header-text h2{color:var(--text-heading);font-size:14.5px;font-weight:600;letter-spacing:-.1px;margin:0}.bk-dashboard-card .card-header-text p{color:var(--text-muted);font-size:12.5px;margin-bottom:0;margin-top:1px}.bk-dashboard-card .card-body{padding:24px}.bk-card-footer{display:flex;flex-direction:column;gap:12px;margin-top:16px}.bk-card-footer .bk-btn{justify-content:center;width:100%}@media screen and (min-width:600px){.bk-card-footer{align-items:flex-end;flex-direction:row}.bk-card-footer .bk-card-footer__info{flex:1;min-width:0}.bk-card-footer .bk-btn{flex-shrink:0;margin-left:auto;width:25%}}.bk-card-footer__info{display:flex;flex-direction:column;gap:8px;min-width:0}.bbk-summary-grid{display:grid;gap:16px;grid-template-columns:1fr;margin-bottom:16px}@media screen and (min-width:960px){.bbk-summary-grid{grid-template-columns:1fr 1fr}}.bbk-size-summary{display:flex;flex-direction:column;gap:14px}.bbk-size-tiles{display:grid;gap:10px;grid-template-columns:repeat(3,1fr)}.bbk-size-tile{align-items:center;border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;flex-direction:column;padding:10px 8px;text-align:center}.bbk-size-tile__number{font-size:22px;font-weight:700;line-height:1.1}.bbk-size-tile__label{color:var(--text-muted);font-size:11px;line-height:1.3;margin-top:4px;text-transform:uppercase}.bbk-size-tile--good{background:var(--green-100);border-color:var(--green-500)}.bbk-size-tile--good .bbk-size-tile__number{color:var(--green-500)}.bbk-size-tile--medium{background:var(--amber-100);border-color:var(--amber-700)}.bbk-size-tile--medium .bbk-size-tile__number{color:var(--amber-700)}.bbk-size-tile--bad{background:var(--red-100);border-color:var(--red-500)}.bbk-size-tile--bad .bbk-size-tile__number{color:var(--red-500)}.bbk-size-bar__track{background:var(--border-card);border-radius:6px;display:flex;height:6px;overflow:hidden}.bbk-size-bar__segment{height:100%;transition:flex .4s ease}.bbk-size-bar__segment--good{background:var(--green-500)}.bbk-size-bar__segment--medium{background:var(--amber-700)}.bbk-size-bar__segment--bad{background:var(--red-500)}.bbk-size-bar__footer{display:flex;justify-content:space-between;margin-top:6px}.bbk-size-bar__total{color:var(--text-muted);font-size:11px}.bbk-size-bar__total strong{color:var(--text-heading)}.bbk-size-bar__attention{color:var(--red-500);font-size:11px;font-weight:500}.bbk-summary-alt-chart{align-items:center;display:flex;gap:24px;padding:8px 0}.bbk-summary-alt-chart__donut{flex-shrink:0}.bbk-summary-alt-chart__donut circle{transition:stroke-dashoffset .5s ease}.bbk-summary-alt-chart__legend{display:flex;flex-direction:column;gap:8px}.bbk-summary-alt-chart__legend-item{align-items:center;color:var(--text-heading);display:flex;font-size:13px;gap:8px}.bbk-summary-alt-chart__legend-dot{border-radius:50%;flex-shrink:0;height:10px;width:10px}.bbk-summary-alt-chart__legend-dot--missing{background:var(--red-500)}.bbk-summary-alt-chart__legend-dot--present{background:var(--green-500)}.bbk-summary-alt-chart__legend-value{font-weight:700;margin-left:auto;padding-left:16px}.bbk-summary-note{color:var(--text-muted);font-size:12px;margin-top:16px;text-align:center}.bbk-summary-skeleton{display:flex;flex-direction:column;gap:10px;padding:4px 0}.bbk-summary-skeleton__line{animation:bk-skeleton-shimmer 1.4s infinite;background:linear-gradient(90deg,var(--border-card) 25%,var(--surface-card) 50%,var(--border-card) 75%);background-size:200% 100%;border-radius:4px;height:14px}.bbk-summary-skeleton__line--short{width:40%}.bbk-summary-skeleton__line--medium{width:65%}.bbk-summary-skeleton__line--full{width:100%}.bbk-email-notifications{display:flex;flex-direction:column;gap:0}.bbk-email-notifications .form-row{display:flex;flex-direction:column;gap:10px;padding:16px 0}.bbk-email-notifications .form-row:first-of-type{padding-top:0}.bbk-email-notifications .form-row--separated{border-top:1px solid var(--border-card);padding-bottom:0}.bbk-email-notifications .form-row__label{display:flex;flex-direction:column;gap:2px}.bbk-email-notifications .form-row__title{color:var(--text-heading);font-size:13.5px;font-weight:600}.bbk-email-notifications .form-row__help{color:var(--text-muted);font-size:12px}.bbk-email-notifications .form-row__control{flex:1}.bbk-email-notifications .form-row__control input[type=text],.bbk-email-notifications .form-row__control select{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);font-size:13.5px;height:40px;padding:0 12px;transition:border-color .15s;width:100%}.bbk-email-notifications .form-row__control input[type=text]:focus,.bbk-email-notifications .form-row__control select:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-email-notifications .form-row__control input[type=text]:disabled,.bbk-email-notifications .form-row__control select:disabled{cursor:not-allowed;opacity:.6}.bbk-email-hint{align-items:flex-start;border-left:3px solid var(--brand);display:flex;gap:10px;margin-top:18px;padding:10px 14px}.bbk-email-hint svg{color:var(--brand);flex-shrink:0;margin-top:1px}.bbk-email-hint p{color:var(--text-muted);font-size:12.5px;line-height:1.6;margin:0}@media screen and (min-width:600px){.bbk-email-notifications .form-row{align-items:center;flex-direction:row;gap:16px}.bbk-email-notifications .form-row__label{flex-shrink:0;width:160px}}.form-feedback{align-items:center;border-radius:var(--radius-button);display:flex;font-size:12.5px;gap:10px;margin:0;padding:10px 14px}.form-feedback svg{flex-shrink:0}.form-feedback--green-500{background:var(--green-100);border:1.5px solid var(--green-300);color:var(--green-700)}.form-feedback--error{background:var(--red-100);border:1.5px solid var(--red-300);color:var(--red-700)}.bbk-send-test{border-top:1px solid var(--border-card);margin-top:20px;padding-top:20px}.bbk-send-test__header{display:flex;flex-direction:column;gap:2px;margin-bottom:12px}.bbk-send-test__title{color:var(--text-heading);font-size:13.5px;font-weight:600}.bbk-send-test__help{color:var(--text-muted);font-size:12px}.bbk-send-test__row{align-items:center;display:flex;gap:8px}.bbk-send-test__input{box-sizing:border-box;flex:1;height:40px;padding:0 12px;transition:border-color .15s}.bbk-send-test__input,.bbk-send-test__input[type=text]{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);color:var(--text-heading);font-size:13.5px}.bbk-send-test__input[type=text]{box-shadow:none}.bbk-send-test__input:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-send-test__input:disabled{cursor:not-allowed;opacity:.6}.bbk-send-test__feedback{margin-top:8px}.bbk-preview-url{align-items:center;color:var(--text-muted);display:flex;font-size:12px;gap:8px;margin-top:12px}.bbk-preview-url__label{flex-shrink:0}.bbk-preview-url__link{color:var(--brand);font-weight:600;text-decoration:none}.bbk-preview-url__link:hover{text-decoration:underline}.bbk-mcp-header-status{align-items:center;border-radius:999px;display:inline-flex;font-size:12px;font-weight:600;line-height:1;padding:3px 10px}.bbk-mcp-header-status.is-active{background:var(--green-100);color:var(--green-700)}.bbk-mcp-header-status.is-inactive{background:var(--red-100);color:var(--red-700)}.bbk-agent-api-card{display:flex;flex-direction:column;gap:14px}.bbk-agent-api-card .bbk-mcp-url-block{display:flex;flex-direction:column;gap:8px}.bbk-agent-api-card .bbk-mcp-url-label{color:var(--text-muted);font-size:12px;font-weight:600;letter-spacing:.05em;margin:0;text-transform:uppercase}.bbk-agent-api-card .bbk-mcp-url-row{align-items:center;background:var(--code-bg);border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;gap:8px;padding:10px 12px}.bbk-agent-api-card .bbk-mcp-url-value{color:var(--text-heading);flex:1;font-size:12.5px;line-height:1.45;min-width:0;word-break:break-all}.bbk-agent-api-card .bbk-mcp-divider{background:var(--border-card);height:1px}.bbk-agent-api-card .bbk-mcp-summary{background:var(--surface-card);border:1px solid var(--border-card);border-radius:var(--radius-button);overflow:hidden}.bbk-agent-api-card .bbk-mcp-summary summary{align-items:center;background:var(--surface-sunken);border-bottom:1px solid transparent;color:var(--text-heading);cursor:pointer;display:flex;font-size:13px;font-weight:600;gap:8px;list-style:none;padding:11px 12px}.bbk-agent-api-card .bbk-mcp-summary summary::-webkit-details-marker{display:none}.bbk-agent-api-card .bbk-mcp-summary summary .bbk-mcp-summary-chevron{color:var(--text-muted);display:inline-flex;line-height:1}.bbk-agent-api-card .bbk-mcp-summary summary .bbk-mcp-summary-chevron svg{display:block;transition:transform .2s}.bbk-agent-api-card .bbk-mcp-summary[open] summary{border-bottom-color:var(--border-card)}.bbk-agent-api-card .bbk-mcp-summary[open] summary .bbk-mcp-summary-chevron svg{transform:rotate(90deg)}.bbk-agent-api-card .bbk-mcp-summary .bbk-mcp-summary__content{background:var(--surface-sunken);border-top:1px solid var(--border-card);display:flex;flex-direction:column;gap:10px;padding:12px}.bbk-agent-api-card .bbk-mcp-config-block{display:flex;flex-direction:column;gap:10px}.bbk-agent-api-card .bbk-mcp-config-title{color:var(--text-muted);font-size:12px;font-weight:600;letter-spacing:.05em;margin:0;text-transform:uppercase}.bbk-agent-api-card .bbk-mcp-steps{display:flex;flex-direction:column;gap:10px;list-style:none;margin:0;padding-left:0}.bbk-agent-api-card .bbk-mcp-steps li{-moz-column-gap:10px;column-gap:10px;display:grid;grid-template-columns:24px 1fr;row-gap:2px}.bbk-agent-api-card .bbk-mcp-steps li:before{align-items:center;background:var(--surface-card);border:1px solid var(--border-card);border-radius:50%;color:var(--text-muted);content:counter(bbk-mcp-step);counter-increment:bbk-mcp-step;display:inline-flex;font-size:11px;font-weight:700;height:20px;justify-content:center;margin-top:1px;width:20px}.bbk-agent-api-card .bbk-mcp-steps{counter-reset:bbk-mcp-step}.bbk-agent-api-card .bbk-mcp-steps span,.bbk-agent-api-card .bbk-mcp-steps strong{grid-column:2}.bbk-agent-api-card .bbk-mcp-steps strong{color:var(--text-heading);font-size:13px;font-weight:600}.bbk-agent-api-card .bbk-mcp-steps span{color:var(--text-muted);font-size:12.5px;line-height:1.5}.bbk-agent-api-card .bbk-mcp-code-block{background:var(--code-bg);border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;flex-direction:column;gap:8px;padding:10px}.bbk-agent-api-card .bbk-mcp-code-block .bk-btn{align-self:flex-end}.bbk-agent-api-card .bbk-mcp-code-block pre{background:none;border:none;margin:0;overflow-x:auto;padding:0}.bbk-agent-api-card .bbk-mcp-code-block code{font-size:12px;line-height:1.5;white-space:pre}.bbk-agent-api-card .bbk-mcp-info-box{align-items:flex-start;background:var(--amber-100);border-left:3px solid var(--amber-700);margin-top:2px;padding:10px 14px}.bbk-agent-api-card .bbk-mcp-info-box p{font-size:12.5px;line-height:1.6;margin:0}.bbk-agent-api-card p{color:var(--text-muted);font-size:13px;margin:0}.bbk-agent-api-card p code{font-size:12px}.bbk-agent-api-card .bbk-notice{margin-top:2px}.bbk-agent-api-card__action{margin-top:6px}.bbk-agent-api-card__action .bk-btn{justify-content:center;width:100%}@media screen and (min-width:600px){.bbk-agent-api-card__action .bk-btn{width:auto}}@media screen and (max-width:640px){.bbk-agent-api-card .bbk-mcp-url-row{align-items:stretch;flex-direction:column}.bbk-agent-api-card .bbk-mcp-code-block .bk-btn,.bbk-agent-api-card .bbk-mcp-url-row .bk-btn{justify-content:center;width:100%}}.bbk-tools-abilities-panel .bk-dashboard-card{margin-bottom:16px}.bbk-tools-placeholder{color:var(--text-muted);font-size:13px;margin:0}.bbk-tools-toolbar{align-items:center;display:flex;flex-wrap:wrap;gap:12px;justify-content:space-between;margin-bottom:12px}.bbk-tools-search-wrap{flex:1;min-width:200px;position:relative}.bbk-tools-search-wrap svg{color:var(--text-muted);left:10px;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%)}.bbk-tools-search-wrap input[type=search].bbk-tools-search{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-shadow:none;box-sizing:border-box;color:var(--text-heading);font-size:13px;height:32px;outline:none;padding:0 12px 0 34px;transition:border-color .15s;width:100%}.bbk-tools-search-wrap input[type=search].bbk-tools-search:focus{border-color:var(--brand);box-shadow:var(--focus-ring)}.bbk-tools-search-wrap input[type=search].bbk-tools-search::-webkit-search-cancel-button{display:none}.bbk-tools-toolbar-actions{align-items:center;display:flex;flex-shrink:0;gap:8px}.bbk-tools-enabled-count{color:var(--text-muted);font-size:12px;padding:0 4px;white-space:nowrap}.bbk-tools-no-results{color:var(--text-muted);font-size:13px;padding:20px 12px;text-align:center}.bk-btn-sm{font-size:12px;gap:5px;padding:6px 12px}.bk-btn-sm svg{height:13px;width:13px}.bbk-tools-table-wrap{border:1px solid var(--border-card);border-radius:var(--radius-button);overflow-x:auto}.bbk-tools-table{border-collapse:collapse;min-width:700px;width:100%}.bbk-tools-table thead th{background:var(--surface-sunken);border-bottom:1px solid var(--border-card);color:var(--text-muted);font-size:12px;letter-spacing:.4px;padding:11px 12px;text-align:left;text-transform:uppercase}.bbk-tools-table thead th.bbk-tools-col-expand{padding:11px 8px;width:40px}.bbk-tools-table thead th.bbk-tools-col-help{text-align:center;width:60px}.bbk-tools-table thead th.bbk-tools-col-role{width:160px}.bbk-tools-table thead th.bbk-tools-col-enabled{text-align:center;width:80px}.bbk-tools-table tbody td{border-bottom:1px solid var(--border-card);font-size:13px;padding:12px;vertical-align:middle}.bbk-tools-table tbody td.bbk-tools-col-expand{padding:12px 8px}.bbk-tools-table tbody td.bbk-tools-col-enabled,.bbk-tools-table tbody td.bbk-tools-col-help{text-align:center}.bbk-tools-table tbody tr.is-disabled td{opacity:.58}.bbk-tools-table .bbk-tools-role-warning{color:var(--amber-700);font-size:11px;line-height:1.3;margin:6px 0 0}.bbk-tools-table select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--surface-card);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2712%27 height=%2712%27 fill=%27none%27 stroke=%27%23485a69%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272.5%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27m6 9 6 6 6-6%27/%3E%3C/svg%3E");background-position:right 8px center;background-repeat:no-repeat;border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);cursor:pointer;font-size:13px;height:32px;padding:0 28px 0 10px;transition:border-color .15s;width:100%}.bbk-tools-table select:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-tools-toggle{cursor:pointer;display:inline-block;height:24px;position:relative;vertical-align:middle;width:44px}.bbk-tools-toggle input{cursor:pointer;height:100%;inset:0;margin:0;opacity:0;position:absolute;width:100%;z-index:1}.bbk-tools-toggle:before{background:var(--border-strong);border-radius:12px;content:"";inset:0;position:absolute;transition:background .2s}.bbk-tools-toggle:after{background:var(--surface-card);border-radius:50%;box-shadow:0 1px 3px rgba(0,0,0,.2);content:"";height:20px;left:2px;position:absolute;top:2px;transition:transform .2s;width:20px}.bbk-tools-toggle:has(input:checked):before{background:var(--brand)}.bbk-tools-toggle:has(input:checked):after{transform:translateX(20px)}.bbk-tools-expand-btn{align-items:center;background:none;border:none;border-radius:4px;color:var(--text-muted);cursor:pointer;display:inline-flex;justify-content:center;line-height:1;padding:4px}.bbk-tools-expand-btn svg{display:block;transition:transform .2s}.bbk-tools-expand-btn.is-open svg{transform:rotate(90deg)}.bbk-tools-expand-btn:hover{color:var(--brand)}.bbk-tools-help-btn{align-items:center;background:var(--surface-sunken);border:1px solid var(--border-card);border-radius:50%;color:var(--text-muted);cursor:pointer;display:inline-flex;font-size:13px;font-weight:700;height:22px;justify-content:center;line-height:1;padding:0;transition:background .15s,color .15s,border-color .15s;width:22px}.bbk-tools-help-btn.is-active,.bbk-tools-help-btn:hover{background:var(--brand);border-color:var(--brand);color:var(--text-invert)}.bbk-tools-table tbody tr:has(+.bbk-tools-info-row)>td:first-child{border-left:3px solid var(--brand)}.bbk-tools-info-row td{border-bottom:1px solid var(--border-card);border-left:3px solid var(--brand);padding:0}.bbk-tools-info-panel{background:var(--surface-sunken);padding:16px 20px}.bbk-tools-info-desc{color:var(--text-heading);font-size:13px;margin:0}.bbk-tools-info-layout{align-items:start;display:grid;gap:10px 24px;grid-template-columns:140px 1fr}.bbk-tools-info-label{color:var(--brand);font-size:11px;font-weight:700;letter-spacing:.6px;padding-top:2px;text-transform:uppercase}.bbk-tools-info-criteria{color:var(--text-heading);font-size:13px;line-height:1.5;margin:0}.bbk-tools-examples-list{display:flex;flex-direction:column;gap:4px}.bbk-tools-example{align-items:flex-start;color:var(--text-heading);display:flex;font-size:12px;gap:8px;padding:3px 0}.bbk-tools-example:before{color:var(--brand);content:">_";flex-shrink:0;font-family:monospace;font-size:11px;font-style:normal;font-weight:600;padding-top:1px}.bbk-tools-actions{display:flex;justify-content:flex-end;margin-top:16px}.bbk-upload-limit-card,.bbk-upload-limit-layout{display:flex;flex-direction:column;gap:20px}@media screen and (min-width:960px){.bbk-upload-limit-layout{align-items:start;display:grid;gap:20px 28px;grid-template-areas:"toggle size" "message preview" "image preview";grid-template-columns:1.2fr 1fr}}.bbk-upload-limit-row--toggle{align-items:flex-start;display:flex;gap:14px}@media screen and (min-width:960px){.bbk-upload-limit-row--toggle{grid-area:toggle}.bbk-upload-limit-field--size{align-items:flex-end;grid-area:size;justify-self:end;max-width:260px;text-align:right}.bbk-upload-limit-field--message{grid-area:message}.bbk-upload-limit-field--image{grid-area:image}.bbk-upload-limit-field--preview{grid-area:preview;height:100%}.bbk-upload-limit-row--toggle{-ms-grid-column:1;-ms-grid-row:1}.bbk-upload-limit-field--size{-ms-grid-column:3;-ms-grid-row:1}.bbk-upload-limit-field--message{-ms-grid-column:1;-ms-grid-row:3}.bbk-upload-limit-field--image{-ms-grid-column:1;-ms-grid-row:5}.bbk-upload-limit-field--preview{-ms-grid-row:3;-ms-grid-row-span:3;-ms-grid-column:3}}.bbk-upload-limit-row-text strong{color:var(--text-heading);display:block;font-size:13px;margin-bottom:2px}.bbk-upload-limit-row-text p{color:var(--text-muted);font-size:12px;margin:0}.bbk-upload-limit-field{display:flex;flex-direction:column;gap:6px}.bbk-upload-limit-field>.bbk-upload-limit-field-label,.bbk-upload-limit-field>label{color:var(--text-heading);font-size:13px;font-weight:600}.bbk-upload-limit-field-header{align-items:center;display:flex;gap:12px;justify-content:space-between}.bbk-upload-limit-hint{color:var(--text-muted);font-size:11px;margin:0}.bbk-upload-limit-max-size-input{align-items:center;display:flex;gap:8px;max-width:160px}.bbk-upload-limit-max-size-input input[type=number]{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);flex:1;font-size:13px;height:32px;padding:0 10px}.bbk-upload-limit-max-size-input input[type=number]:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-upload-limit-max-size-input input[type=number]:disabled{cursor:not-allowed;opacity:.6}.bbk-upload-limit-max-size-input span{color:var(--text-muted);font-size:12px}.bbk-upload-limit-message-input{background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:var(--radius-button);box-sizing:border-box;color:var(--text-heading);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:1.5;min-height:140px;padding:10px 12px;resize:vertical;width:100%}.bbk-upload-limit-message-input:focus{border-color:var(--brand);box-shadow:var(--focus-ring);outline:none}.bbk-upload-limit-message-input:disabled{cursor:not-allowed;opacity:.6}.bbk-upload-limit-image-preview img{border:1px solid var(--border-card);border-radius:var(--radius-button);display:block;height:auto;max-height:160px;max-width:240px;width:auto}.bbk-upload-limit-image-actions{display:flex;gap:8px}.bbk-upload-limit-mock-overlay{align-items:center;background:rgba(0,0,0,.55);border-radius:var(--radius-button);box-sizing:border-box;display:flex;justify-content:center;padding:24px}@media screen and (min-width:960px){.bbk-upload-limit-mock-overlay{height:100%}}.bbk-upload-limit-mock-dialog{background:#fff;border-radius:10px;box-shadow:0 20px 50px rgba(0,0,0,.3);box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;padding:28px 28px 24px;position:relative;width:100%}.bbk-upload-limit-mock-close{color:#50575e;font-size:20px;height:32px;line-height:32px;position:absolute;right:12px;text-align:center;top:12px;width:32px}.bbk-upload-limit-mock-title{color:#1d2327;font-size:18px;font-weight:600;margin:0 28px 14px 0}.bbk-upload-limit-mock-body{color:#1d2327;font-size:14px;line-height:1.6}.bbk-upload-limit-mock-body a{color:#2271b1}.bbk-upload-limit-mock-body strong{font-weight:600}.bbk-upload-limit-mock-files{background:#f6f7f7;border-radius:6px;font-size:13px;list-style:disc;list-style-position:inside;margin:14px 0 0;padding:10px 14px}.bbk-upload-limit-mock-files li{word-break:break-all}.bbk-upload-limit-mock-file-size{color:var(--red-700);font-weight:700}.bbk-upload-limit-mock-image{border:1px solid #dcdcde;border-radius:6px;display:block;height:auto;margin-top:16px;max-width:100%}.upload-zone{background:var(--surface-card);border:2px dashed var(--border-card);border-radius:var(--radius-button);cursor:pointer;padding:28px;position:relative;text-align:center;transition:all .2s}.upload-zone.upload-zone--dragging,.upload-zone:hover{background:var(--brand-soft);border-color:var(--brand)}.upload-zone input[type=file]{cursor:pointer;height:100%;inset:0;opacity:0;position:absolute;width:100%}.upload-zone p{color:var(--text-muted);font-size:13px}.upload-zone p strong{color:var(--brand);font-weight:500}.upload-zone .upload-hint{color:var(--text-muted);font-size:11.5px;margin-top:4px}.upload-zone-icon{align-items:center;background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:8px;box-shadow:var(--shadow-pluma);color:var(--text-muted);display:flex;height:40px;justify-content:center;margin:0 auto 10px;width:40px}.file-selected{align-items:center;background:var(--green-100);border:1.5px solid var(--green-300);border-radius:var(--radius-button);color:var(--green-700);display:flex;gap:10px;padding:10px 14px}.file-selected span{font-size:.85rem;font-weight:500}.file-selected .file-name{font-size:.75rem}.bk-progress-bar{display:flex;flex-direction:column;gap:6px}.bk-progress-bar__track{background:var(--border-card);border-radius:3px;height:6px;overflow:hidden}.bk-progress-bar__fill{background:var(--brand);height:100%;transition:width var(--transition-base)}.bk-progress-bar__label{color:var(--text-muted);font-size:.75rem}.bbk-import-report{border-top:1px solid var(--border-card);display:flex;flex-direction:column;gap:16px;margin-top:20px;padding-top:20px}.bbk-import-report__head{display:flex;flex-direction:column;gap:12px}@media screen and (min-width:600px){.bbk-import-report__head{align-items:flex-start;flex-direction:row;gap:24px;justify-content:space-between}}.bbk-import-report__head .bk-btn{flex-shrink:0}.bbk-import-report__title{color:var(--text-heading);font-size:1rem;font-weight:600;letter-spacing:-.1px;margin:0}.bbk-import-report__title--ok{color:var(--green-700)}.bbk-import-report__title--attention{color:var(--red-700)}.bbk-import-report__lead{color:var(--text-muted);font-size:.85rem;margin:2px 0 0}.bbk-import-report__tone--ok{color:var(--text-heading)}.bbk-import-report__tone--bad{color:var(--red-700)}.bbk-import-report__tone--neutral{color:var(--text-muted)}.bbk-import-report__note{color:var(--text-muted);font-size:.8rem;margin:0}.bbk-import-report__warning{background:var(--amber-100);border-radius:var(--radius-button);color:var(--amber-700);font-size:.8rem;margin:0;padding:10px 14px}.bbk-import-report__details summary{align-items:center;color:var(--brand);cursor:pointer;display:inline-flex;font-size:.85rem;font-weight:500;gap:8px;list-style:none;padding:4px 0}.bbk-import-report__details summary::-webkit-details-marker{display:none}.bbk-import-report__details summary:before{border-bottom:2px solid;border-right:2px solid;content:"";flex-shrink:0;height:6px;margin:0 2px 0 1px;transform:rotate(-45deg);width:6px}@media(prefers-reduced-motion:no-preference){.bbk-import-report__details summary:before{transition:transform var(--transition-fast)}}.bbk-import-report__details summary:hover{color:var(--brand-hover)}.bbk-import-report__details summary:focus-visible{border-radius:var(--radius-button);box-shadow:var(--focus-ring);outline:none}.bbk-import-report__details[open] summary:before{transform:rotate(45deg)}.bbk-import-report__table-wrap{border:1px solid var(--border-card);border-radius:var(--radius-button);margin-top:8px;max-height:360px;overflow:auto}.bbk-import-report__table-wrap:focus-visible{box-shadow:var(--focus-ring);outline:none}.bbk-import-report__table{border-collapse:collapse;font-size:.78rem;font-variant-numeric:tabular-nums;width:100%}.bbk-import-report__table td,.bbk-import-report__table th{border-bottom:1px solid var(--border-card);padding:8px 12px;text-align:left;vertical-align:top}.bbk-import-report__table tbody tr:last-child td{border-bottom:0}.bbk-import-report__table th{background:var(--surface-card);box-shadow:0 1px 0 var(--border-card);color:var(--text-muted);font-size:.7rem;font-weight:600;letter-spacing:.02em;position:sticky;top:0}.bbk-import-report__table td:nth-child(-n+2),.bbk-import-report__table th:nth-child(-n+2){white-space:nowrap;width:1%}.bbk-import-report__alt{color:var(--text-heading);max-width:320px;min-width:180px;overflow-wrap:anywhere;white-space:pre-wrap}.bbk-import-report__empty{color:var(--text-muted)}.bbk-import-report__status{font-weight:600;white-space:nowrap}.bbk-import-report__reason{color:var(--text-muted);min-width:180px}.bbk-import-report__more{margin-top:8px}.bk-export-form{display:flex;flex-direction:column;gap:16px}.bk-filters-grid{display:grid;gap:16px;grid-template-columns:1fr 1fr}@media(max-width:600px){.bk-filters-grid{grid-template-columns:1fr}}.bk-filter-group{display:flex;flex-direction:column;gap:8px}.bk-filter-label{color:var(--text-muted);font-size:12.5px;font-weight:500}.bk-chip-group{display:flex;flex-wrap:wrap;gap:6px}.bk-chip{align-items:center;background:var(--surface-card);border:1.5px solid var(--border-card);border-radius:20px;color:var(--text-muted);cursor:pointer;display:inline-flex;font-size:12.5px;font-weight:500;gap:6px;line-height:1;padding:5px 12px;transition:border-color .15s,background .15s,color .15s}.bk-chip.bk-chip--active,.bk-chip:hover{border-color:var(--brand);color:var(--brand)}.bk-chip.bk-chip--active{background:var(--brand-soft)}.bk-chip.bk-chip--good.bk-chip--active{background:var(--green-100);border-color:var(--green-500);color:var(--green-500)}.bk-chip.bk-chip--mid.bk-chip--active{background:var(--amber-100);border-color:var(--amber-700);color:var(--amber-700)}.bk-chip.bk-chip--bad.bk-chip--active{background:var(--red-100);border-color:var(--red-500);color:var(--red-500)}.bk-size-dot{border-radius:50%;display:inline-block;flex-shrink:0;height:8px;width:8px}.bk-size-dot.bk-size-dot--good{background:var(--green-500)}.bk-size-dot.bk-size-dot--mid{background:var(--amber-700)}.bk-size-dot.bk-size-dot--bad{background:var(--red-500)}.bk-size-legend{background:var(--surface-sunken);border:1px solid var(--border-card);border-radius:var(--radius-button);display:flex;flex-wrap:wrap;gap:20px;padding:12px 16px}.bk-size-legend__item{align-items:center;color:var(--text-muted);display:flex;font-size:12.5px;gap:5px}.bk-size-legend__label{font-weight:600;margin-right:2px}.bk-size-legend__label.bk-size-legend__label--good{color:var(--green-500)}.bk-size-legend__label.bk-size-legend__label--mid{color:var(--amber-700)}.bk-size-legend__label.bk-size-legend__label--bad{color:var(--red-500)}.bk-export-count{color:var(--text-muted);font-size:13px;margin:0}.bk-export-count strong{color:var(--text-heading);font-weight:600}.bk-footer-main{animation:bk-fadeUp .5s ease both;border-top:1px solid var(--border-card);margin-top:48px;padding-top:40px}.bk-footer-main__inner{background:var(--surface-card);border:1px solid var(--border-card);border-radius:var(--radius-large);box-shadow:var(--shadow-pluma);display:grid;gap:48px;grid-template-columns:60fr 40fr;padding:36px 40px}.bk-footer-main__icon{align-items:center;background:var(--brand-soft);border-radius:var(--radius-button);display:flex;flex-shrink:0;height:32px;justify-content:center;width:32px}.bk-footer-main__icon svg{fill:none;height:16px;stroke:var(--brand);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:16px}.bk-footer-main__section-title{align-items:center;display:flex;gap:12px;margin-bottom:10px}.bk-footer-main__heading{color:var(--text-heading);font-size:14px;font-weight:600;line-height:1.4;margin:0}.bk-footer-main__heading span{color:var(--text-muted);font-weight:400}.bk-footer-main__description{color:var(--text-muted);font-size:13px;line-height:1.6;margin-bottom:20px;padding-left:44px}.bk-footer-main__divider{background:var(--border-card);height:1px;margin:0 0 16px 44px}.bk-footer-main__links{display:flex;flex-direction:column;gap:10px;list-style:none;margin:0;padding-left:44px}.bk-footer-main__links li{align-items:flex-start;display:flex;gap:8px}.bk-footer-main__links li svg{fill:none;flex-shrink:0;height:13px;margin-top:2px;opacity:.55;stroke:var(--brand);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:13px}.bk-footer-main__links a{color:var(--brand);font-size:13px;line-height:1.45;text-decoration:none;transition:color .15s}.bk-footer-main__links a:hover{color:var(--brand-hover);text-decoration:underline}.bk-footer-main__links a code{background:var(--brand-soft);border-radius:4px;font-family:monospace;font-size:12px;padding:1px 4px}.bk-footer-main__team{border-left:1px solid var(--border-card);padding-left:40px}.bk-footer-main__team-title{align-items:flex-start;display:flex;gap:12px;margin-bottom:10px}.bk-footer-main__team-heading{color:var(--text-heading);font-size:14px;font-weight:600;line-height:1.4;margin:0}.bk-footer-main__team-description{color:var(--text-muted);font-size:13px;line-height:1.6;margin-bottom:20px}.bk-footer-main__services{display:flex;flex-direction:column;gap:9px;list-style:none;margin:0 0 24px;padding:0}.bk-footer-main__services li{align-items:flex-start;color:var(--text-heading);display:flex;font-size:13px;gap:9px;line-height:1.4}.bk-footer-main__services li svg{fill:none;flex-shrink:0;height:14px;opacity:.7;stroke:var(--brand);stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:14px}.bk-footer-main__cta{align-items:center;border:1px solid rgba(35,146,149,.35);border-radius:var(--radius-button);color:var(--brand);display:inline-flex;font-size:13px;font-weight:500;gap:6px;padding:9px 18px;text-decoration:none;transition:background .15s,border-color .15s,color .15s}.bk-footer-main__cta:hover{background:var(--brand-soft);border-color:var(--brand);color:var(--brand-hover)}.bk-footer-main__cta svg{fill:none;height:13px;stroke:currentcolor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2;width:13px}@media(max-width:780px){.bk-footer-main__inner{grid-template-columns:1fr}.bk-footer-main__team{border-left:none;border-top:1px solid var(--border-card);padding-left:0;padding-top:28px}}#wpcontent{padding-left:0}ul#adminmenu a.wp-has-current-submenu:after,ul#adminmenu>li.current>a.current:after{border-right-color:#eff4f8}#wpbody-content{padding-bottom:0}#wpbody-content>.wrap{margin:0;padding:0}#wpbody-content>.notice,#wpfooter,.notice.notice-warning.update-nag,.wp-core-ui .notice.is-dismissible{display:none!important}#bbk-media-library-app{background:var(--bg-page);border-bottom:4px solid var(--border-card);color:var(--text-heading);line-height:1.5;min-height:100vh;padding:40px 24px} -
bubuku-media-library/trunk/bubuku-media-library.php
r3741020 r3751624 7 7 * Requires PHP: 7.4 8 8 * Tested up to: 7.0 9 * Version: 1.4. 29 * Version: 1.4.3 10 10 * Author: Bubuku I code 11 11 * Author URI: https://www.bubuku.com/ -
bubuku-media-library/trunk/includes/tools/class-tool-import-attachments-alt.php
r3741020 r3751624 47 47 * Sobrescribe ALT existentes (destructive). Se declara idempotent=false adrede aunque repetirla no cambie nada: con destructive+idempotent core exige DELETE en /run y el CSV iría en la query string, inviable con lotes grandes. Con false se mantiene POST + body JSON. 48 48 */ 49 public function get_output_schema(): array { 50 $counter = array( 'type' => 'integer' ); 51 52 return array( 53 'type' => 'object', 54 'properties' => array( 55 'success' => array( 'type' => 'boolean' ), 56 'message' => array( 'type' => 'string' ), 57 'data' => array( 58 'type' => 'object', 59 'properties' => array( 60 'updated' => $counter, 61 'unchanged' => $counter, 62 'cleared' => $counter, 63 'rejected' => $counter, 64 'skipped' => $counter, 65 'errors' => array( 66 'type' => 'array', 67 'items' => array( 'type' => 'string' ), 68 ), 69 'results' => array( 70 'type' => 'array', 71 'items' => array( 72 'type' => 'object', 73 'properties' => array( 74 'index' => $counter, 75 'id' => $counter, 76 'status' => array( 'type' => 'string' ), 77 'reason' => array( 'type' => 'string' ), 78 'normalized' => array( 'type' => 'boolean' ), 79 'superseded_by' => $counter, 80 ), 81 ), 82 ), 83 ), 84 ), 85 ), 86 ); 87 } 88 49 89 public function get_annotations(): array { 50 90 return array( … … 87 127 } 88 128 89 $updated = 0;90 $skipped = 0;91 $errors = array();92 93 $attachment_ids = array_values(94 array_unique(95 array_filter(96 array_map(97 static function ( $row ) {98 return isset( $row['ID'] ) ? absint( $row['ID'] ) : 0;99 },100 $rows101 )102 )103 )104 );105 106 // Prime the post cache for the whole chunk in one query before suspending107 // cache addition below, so get_post_type() in the loop reads from cache108 // instead of running one query per row.109 if ( ! empty( $attachment_ids ) ) {110 get_posts(111 array(112 'post_type' => 'attachment',113 'post_status' => 'inherit',114 'post__in' => $attachment_ids,115 'posts_per_page' => count( $attachment_ids ),116 'no_found_rows' => true,117 'fields' => 'all',118 )119 );120 }121 122 wp_suspend_cache_addition( true );123 124 foreach ( $rows as $index => $row ) {125 $attachment_id = isset( $row['ID'] ) ? absint( $row['ID'] ) : 0;126 $alt_text = isset( $row['Alt Text'] ) ? sanitize_text_field( $row['Alt Text'] ) : '';127 128 if ( 0 === $attachment_id || 'attachment' !== get_post_type( $attachment_id ) ) {129 $errors[] = sprintf(130 /* translators: %1$d: row index, %2$s: attachment ID */131 __( 'Row %1$d: Invalid attachment ID (%2$s).', 'bubuku-media-library' ),132 $index + 1,133 $attachment_id134 );135 continue;136 }137 138 // Object-level check: `upload_files` alone does not imply the caller139 // may edit this specific attachment (e.g. one attached to a private140 // post owned by someone else). Skip it rather than aborting the chunk.141 if ( ! current_user_can( 'edit_post', $attachment_id ) ) {142 ++$skipped;143 continue;144 }145 146 update_post_meta( $attachment_id, '_wp_attachment_image_alt', $alt_text );147 ++$updated;148 }149 150 wp_suspend_cache_addition( false );151 152 foreach ( $attachment_ids as $attachment_id ) {153 clean_post_cache( $attachment_id );154 }155 156 if ( $updated > 0 ) {157 $db = new \Bubuku\Plugins\MediaLibrary\BML_db();158 $db->invalidate_summary_counts_cache();159 }160 161 129 return array( 162 130 'success' => true, 163 'data' => array( 164 'updated' => $updated, 165 'skipped' => $skipped, 166 'errors' => $errors, 167 ), 131 'data' => \Bubuku\Plugins\MediaLibrary\BML_Alt_Importer::import_rows( $rows ), 168 132 ); 169 133 } … … 271 235 $rows[] = array( 272 236 'ID' => absint( $id_value ), 273 'Alt Text' => sanitize_text_field( $alt_value ),237 'Alt Text' => $alt_value, 274 238 ); 275 239 } -
bubuku-media-library/trunk/readme.txt
r3741020 r3751624 5 5 Tested up to: 7.0 6 6 Requires PHP: 7.4 7 Stable tag: 1.4. 27 Stable tag: 1.4.3 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 179 179 180 180 == Changelog == 181 = 1.4.3 = 182 - Fixed ALT CSV imports of more than 100 rows, where only the first batch of 100 was applied and the rest were reported as errors. 183 - New import report: after importing, see how many rows were updated, unchanged, rejected or skipped, and review each affected row (CSV row number, ID, ALT text and reason) in a collapsible table. 184 - New "Download pending rows CSV" button: download only the rows that could not be applied, fix them and import them again. 185 - An ALT value is now only counted as updated after checking what was saved. Rows without an Alt Text value are rejected instead of emptying the ALT, and backslashes in ALT texts are kept. 186 - Importing a CSV exported by the plugin no longer keeps the leading apostrophe that the export adds to ALT texts starting with =, +, - or @. 187 - The "Import ALT text" ability now returns the result of every row. 188 - Fixed the ALT accessibility donut on the Overview tab, which only showed the grey track instead of the progress arc. 189 181 190 = 1.4.2 = 182 191 - Abilities now declare whether they only read data (annotations) and describe their output (output schema) for the summary and attachment tools, so MCP clients can use them more reliably. -
bubuku-media-library/trunk/src/BML_Plugin.php
r3741020 r3751624 96 96 } 97 97 if ( ! defined( 'BUBUKU_BML_PLUGIN_VERSION' ) ) { 98 define( 'BUBUKU_BML_PLUGIN_VERSION', '1.4. 2' );98 define( 'BUBUKU_BML_PLUGIN_VERSION', '1.4.3' ); 99 99 } 100 100 if ( ! defined( 'BUBUKU_BML_ABILITIES_AVAILABLE' ) ) { -
bubuku-media-library/trunk/src/BML_Restapi.php
r3741020 r3751624 706 706 } 707 707 708 $updated = 0; 709 $skipped = 0; 710 $errors = array(); 711 712 $attachment_ids = array_values( 713 array_unique( 714 array_filter( 715 array_map( 716 static function ( $row ) { 717 return isset( $row['ID'] ) ? absint( $row['ID'] ) : 0; 718 }, 719 $rows 720 ) 721 ) 722 ) 723 ); 724 725 // Prime the post cache for the whole chunk in one query before suspending 726 // cache addition below, so get_post_type() in the loop reads from cache 727 // instead of running one query per row. 728 if ( ! empty( $attachment_ids ) ) { 729 get_posts( 730 array( 731 'post_type' => 'attachment', 732 'post_status' => 'inherit', 733 'post__in' => $attachment_ids, 734 'posts_per_page' => count( $attachment_ids ), 735 'no_found_rows' => true, 736 'fields' => 'all', 737 ) 738 ); 739 } 740 741 wp_suspend_cache_addition( true ); 742 743 foreach ( $rows as $index => $row ) { 744 $attachment_id = isset( $row['ID'] ) ? absint( $row['ID'] ) : 0; 745 $alt_text = isset( $row['Alt Text'] ) ? sanitize_text_field( $row['Alt Text'] ) : ''; 746 747 if ( 0 === $attachment_id || 'attachment' !== get_post_type( $attachment_id ) ) { 748 $errors[] = sprintf( 749 /* translators: %1$d: row index, %2$s: attachment ID */ 750 esc_html__( 'Row %1$d: Invalid attachment ID (%2$s).', 'bubuku-media-library' ), 751 $index + 1, 752 $attachment_id 753 ); 754 continue; 755 } 756 757 // Object-level check: `upload_files` alone does not imply the caller 758 // may edit this specific attachment (e.g. one attached to a private 759 // post owned by someone else). Skip it rather than aborting the chunk. 760 if ( ! current_user_can( 'edit_post', $attachment_id ) ) { 761 ++$skipped; 762 continue; 763 } 764 765 update_post_meta( $attachment_id, '_wp_attachment_image_alt', $alt_text ); 766 ++$updated; 767 } 768 769 wp_suspend_cache_addition( false ); 770 771 foreach ( $attachment_ids as $attachment_id ) { 772 clean_post_cache( $attachment_id ); 773 } 774 775 if ( $updated > 0 ) { 776 $this->_db->invalidate_summary_counts_cache(); 777 } 708 // The lock only guards against concurrent chunks from the same user: it is 709 // released as soon as this chunk finishes so the admin importer can send 710 // the next chunk right away instead of receiving a 429 for 10 seconds. 711 try { 712 return $this->process_alt_chunk_rows( $rows ); 713 } finally { 714 $this->release_rate_limit_lock( 'import_alt_chunk' ); 715 } 716 } 717 718 /** 719 * Apply the ALT updates of a chunk. 720 * 721 * @param array $rows Rows with `ID` and `Alt Text` keys. 722 * @return \WP_REST_Response 723 */ 724 private function process_alt_chunk_rows( $rows ) { 725 $report = BML_Alt_Importer::import_rows( $rows ); 778 726 779 727 return rest_ensure_response( 780 728 array( 781 729 'success' => true, 782 'data' => array( 783 'updated' => $updated, 784 'skipped' => $skipped, 785 'errors' => $errors, 786 ), 730 'data' => $report, 787 731 ) 788 732 ); … … 1112 1056 */ 1113 1057 private function acquire_rate_limit_lock( $operation, $ttl_seconds ) { 1114 $user_id = get_current_user_id(); 1115 $transient_key = 'bbk_rl_' . sanitize_key( (string) $operation ) . '_' . absint( $user_id ); 1058 $transient_key = $this->get_rate_limit_key( $operation ); 1116 1059 1117 1060 if ( get_transient( $transient_key ) ) { … … 1122 1065 1123 1066 return true; 1067 } 1068 1069 /** 1070 * Release a rate-limit lock before its TTL expires. 1071 * 1072 * @param string $operation Operation identifier. 1073 * @return void 1074 */ 1075 private function release_rate_limit_lock( $operation ) { 1076 delete_transient( $this->get_rate_limit_key( $operation ) ); 1077 } 1078 1079 /** 1080 * Build the per-user transient key of a rate-limit lock. 1081 * 1082 * @param string $operation Operation identifier. 1083 * @return string 1084 */ 1085 private function get_rate_limit_key( $operation ) { 1086 return 'bbk_rl_' . sanitize_key( (string) $operation ) . '_' . absint( get_current_user_id() ); 1124 1087 } 1125 1088
Note:
See TracChangeset
for help on using the changeset viewer.