qrdx 0.0.49 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -3
- package/dist/core.js +31 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +31 -0
- package/dist/core.mjs.map +1 -0
- package/dist/frames-index.js +1 -1
- package/dist/frames-index.js.map +1 -1
- package/dist/frames-index.mjs +1 -1
- package/dist/frames-index.mjs.map +1 -1
- package/dist/frames-official.js +1 -1
- package/dist/frames-official.js.map +1 -1
- package/dist/frames-official.mjs +1 -1
- package/dist/frames-official.mjs.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/dist/node.js +3 -0
- package/dist/node.js.map +1 -0
- package/dist/node.mjs +3 -0
- package/dist/node.mjs.map +1 -0
- package/dist/qr-code-canvas.js +1 -1
- package/dist/qr-code-canvas.js.map +1 -1
- package/dist/qr-code-canvas.mjs +1 -1
- package/dist/qr-code-canvas.mjs.map +1 -1
- package/dist/src/api.d.ts +8 -2
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/art.d.ts +4 -3
- package/dist/src/art.d.ts.map +1 -1
- package/dist/src/body-patterns.d.ts +3 -2
- package/dist/src/body-patterns.d.ts.map +1 -1
- package/dist/src/core.d.ts +5 -0
- package/dist/src/core.d.ts.map +1 -0
- package/dist/src/corner-dot.d.ts +3 -2
- package/dist/src/corner-dot.d.ts.map +1 -1
- package/dist/src/engine.d.ts +44 -0
- package/dist/src/engine.d.ts.map +1 -0
- package/dist/src/export.d.ts +5 -0
- package/dist/src/export.d.ts.map +1 -0
- package/dist/src/frame.d.ts +6 -4
- package/dist/src/frame.d.ts.map +1 -1
- package/dist/src/frames/catalogue/all.d.ts.map +1 -1
- package/dist/src/frames/catalogue/automotive.d.ts +5 -0
- package/dist/src/frames/catalogue/automotive.d.ts.map +1 -0
- package/dist/src/frames/catalogue/beauty-wellness.d.ts +5 -0
- package/dist/src/frames/catalogue/beauty-wellness.d.ts.map +1 -0
- package/dist/src/frames/catalogue/business.d.ts.map +1 -1
- package/dist/src/frames/catalogue/call-to-action.d.ts.map +1 -1
- package/dist/src/frames/catalogue/counts.d.ts +12 -7
- package/dist/src/frames/catalogue/counts.d.ts.map +1 -1
- package/dist/src/frames/catalogue/food-drink.d.ts.map +1 -1
- package/dist/src/frames/catalogue/health-learning.d.ts.map +1 -1
- package/dist/src/frames/catalogue/index.d.ts.map +1 -1
- package/dist/src/frames/catalogue/nonprofit.d.ts +5 -0
- package/dist/src/frames/catalogue/nonprofit.d.ts.map +1 -0
- package/dist/src/frames/catalogue/places.d.ts.map +1 -1
- package/dist/src/frames/catalogue/real-estate.d.ts +5 -0
- package/dist/src/frames/catalogue/real-estate.d.ts.map +1 -0
- package/dist/src/frames/catalogue/shopping.d.ts.map +1 -1
- package/dist/src/frames/catalogue/sports-fitness.d.ts +5 -0
- package/dist/src/frames/catalogue/sports-fitness.d.ts.map +1 -0
- package/dist/src/frames/catalogue/tags.d.ts.map +1 -1
- package/dist/src/frames/collections.d.ts.map +1 -1
- package/dist/src/frames/official-types.d.ts +1 -1
- package/dist/src/frames/official-types.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -37
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/jsx/index.d.ts +2 -0
- package/dist/src/jsx/index.d.ts.map +1 -0
- package/dist/src/jsx/jsx-dev-runtime.d.ts +5 -0
- package/dist/src/jsx/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/src/jsx/jsx-runtime.d.ts +30 -0
- package/dist/src/jsx/jsx-runtime.d.ts.map +1 -0
- package/dist/src/jsx/runtime.d.ts +73 -0
- package/dist/src/jsx/runtime.d.ts.map +1 -0
- package/dist/src/logo.d.ts +3 -2
- package/dist/src/logo.d.ts.map +1 -1
- package/dist/src/node.d.ts +23 -0
- package/dist/src/node.d.ts.map +1 -0
- package/dist/src/part-markers.d.ts +15 -0
- package/dist/src/part-markers.d.ts.map +1 -0
- package/dist/src/plain.d.ts +31 -0
- package/dist/src/plain.d.ts.map +1 -0
- package/dist/src/qr-code-canvas.d.ts +1 -1
- package/dist/src/qr-code-canvas.d.ts.map +1 -1
- package/dist/src/qr-code-props.d.ts +22 -0
- package/dist/src/qr-code-props.d.ts.map +1 -0
- package/dist/src/qr-code-svg.d.ts +10 -0
- package/dist/src/qr-code-svg.d.ts.map +1 -0
- package/dist/src/qr-code.d.ts +2 -10
- package/dist/src/qr-code.d.ts.map +1 -1
- package/dist/src/rasterize.d.ts +25 -0
- package/dist/src/rasterize.d.ts.map +1 -0
- package/dist/src/react-elements.d.ts +3 -0
- package/dist/src/react-elements.d.ts.map +1 -0
- package/dist/src/render/attributes.d.ts +33 -0
- package/dist/src/render/attributes.d.ts.map +1 -0
- package/dist/src/render/dom.d.ts +8 -0
- package/dist/src/render/dom.d.ts.map +1 -0
- package/dist/src/render/hyperscript.d.ts +10 -0
- package/dist/src/render/hyperscript.d.ts.map +1 -0
- package/dist/src/render/string.d.ts +8 -0
- package/dist/src/render/string.d.ts.map +1 -0
- package/dist/src/svg.d.ts +14 -0
- package/dist/src/svg.d.ts.map +1 -0
- package/dist/src/template/arrow.d.ts +1 -0
- package/dist/src/template/arrow.d.ts.map +1 -1
- package/dist/src/template/default.d.ts +1 -0
- package/dist/src/template/default.d.ts.map +1 -1
- package/dist/src/template/halloween.d.ts +1 -0
- package/dist/src/template/halloween.d.ts.map +1 -1
- package/dist/src/template/square-border.d.ts +1 -0
- package/dist/src/template/square-border.d.ts.map +1 -1
- package/dist/src/template/standard-box.d.ts +1 -0
- package/dist/src/template/standard-box.d.ts.map +1 -1
- package/dist/src/template/striked-box.d.ts +1 -0
- package/dist/src/template/striked-box.d.ts.map +1 -1
- package/dist/src/utils.d.ts +9 -3
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/vanilla-api.d.ts +47 -0
- package/dist/src/vanilla-api.d.ts.map +1 -0
- package/dist/src/vanilla-browser.d.ts +4 -0
- package/dist/src/vanilla-browser.d.ts.map +1 -0
- package/dist/src/vanilla.d.ts +4 -0
- package/dist/src/vanilla.d.ts.map +1 -0
- package/dist/src/vue.d.ts +56 -0
- package/dist/src/vue.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/index.mjs +2 -2
- package/dist/types/public.d.ts +3 -0
- package/dist/types/public.d.ts.map +1 -0
- package/dist/types/qr.d.ts +18 -4
- package/dist/types/qr.d.ts.map +1 -1
- package/dist/types/react.d.ts +5 -0
- package/dist/types/react.d.ts.map +1 -0
- package/dist/types/template.d.ts +7 -1
- package/dist/types/template.d.ts.map +1 -1
- package/dist/vanilla.browser.mjs +92 -0
- package/dist/vanilla.browser.mjs.map +1 -0
- package/dist/vanilla.js +2 -0
- package/dist/vanilla.js.map +1 -0
- package/dist/vanilla.mjs +2 -0
- package/dist/vanilla.mjs.map +1 -0
- package/dist/vue.js +2 -0
- package/dist/vue.js.map +1 -0
- package/dist/vue.mjs +2 -0
- package/dist/vue.mjs.map +1 -0
- package/package.json +71 -6
- package/src/api.tsx +16 -139
- package/src/art.tsx +18 -16
- package/src/body-patterns.tsx +5 -3
- package/src/core.ts +13 -0
- package/src/corner-dot.tsx +4 -2
- package/src/download.tsx +1 -1
- package/src/engine.ts +170 -0
- package/src/export.ts +212 -0
- package/src/frame.tsx +7 -6
- package/src/frames/catalogue/all.ts +606 -0
- package/src/frames/catalogue/automotive.ts +61 -0
- package/src/frames/catalogue/beauty-wellness.ts +61 -0
- package/src/frames/catalogue/business.ts +68 -0
- package/src/frames/catalogue/call-to-action.ts +60 -0
- package/src/frames/catalogue/counts.ts +12 -7
- package/src/frames/catalogue/food-drink.ts +78 -0
- package/src/frames/catalogue/health-learning.ts +62 -14
- package/src/frames/catalogue/index.ts +2440 -16
- package/src/frames/catalogue/nonprofit.ts +65 -0
- package/src/frames/catalogue/places.ts +0 -18
- package/src/frames/catalogue/real-estate.ts +79 -0
- package/src/frames/catalogue/shopping.ts +68 -0
- package/src/frames/catalogue/sports-fitness.ts +81 -0
- package/src/frames/catalogue/tags.ts +354 -0
- package/src/frames/collections.ts +5 -0
- package/src/frames/official/add-engraving.json +90 -0
- package/src/frames/official/add-to-calendar.json +98 -0
- package/src/frames/official/adopt-me.json +72 -0
- package/src/frames/official/aftercare-guide.json +98 -0
- package/src/frames/official/alterations.json +142 -0
- package/src/frames/official/annual-report.json +85 -0
- package/src/frames/official/archery-lesson.json +106 -0
- package/src/frames/official/arrival-guide.json +71 -0
- package/src/frames/official/art-class.json +137 -0
- package/src/frames/official/ask-a-stylist.json +112 -0
- package/src/frames/official/assembly-guide.json +93 -0
- package/src/frames/official/badminton-session.json +104 -0
- package/src/frames/official/bake-sale.json +158 -0
- package/src/frames/official/bakery-board.json +80 -0
- package/src/frames/official/barber-booking.json +64 -0
- package/src/frames/official/bath-ritual.json +70 -0
- package/src/frames/official/bathroom-showroom.json +113 -0
- package/src/frames/official/battery-check.json +95 -0
- package/src/frames/official/beauty-rewards.json +81 -0
- package/src/frames/official/become-a-member.json +79 -0
- package/src/frames/official/bike-service.json +113 -0
- package/src/frames/official/book-a-call.json +105 -0
- package/src/frames/official/book-a-cleaning.json +92 -0
- package/src/frames/official/book-a-consultation.json +101 -0
- package/src/frames/official/book-a-court.json +74 -0
- package/src/frames/official/book-a-facial.json +108 -0
- package/src/frames/official/book-a-massage.json +80 -0
- package/src/frames/official/book-a-vaccine.json +88 -0
- package/src/frames/official/book-this-room.json +80 -0
- package/src/frames/official/boxing-class.json +81 -0
- package/src/frames/official/brewery-tour.json +89 -0
- package/src/frames/official/bridal-beauty.json +80 -0
- package/src/frames/official/brunch-menu.json +79 -0
- package/src/frames/official/bubble-tea.json +81 -0
- package/src/frames/official/bulk-orders.json +108 -0
- package/src/frames/official/burger-order.json +80 -0
- package/src/frames/official/call-a-server.json +115 -0
- package/src/frames/official/car-detailing.json +102 -0
- package/src/frames/official/car-details.json +90 -0
- package/src/frames/official/car-for-sale.json +74 -0
- package/src/frames/official/car-service.json +92 -0
- package/src/frames/official/carpool.json +79 -0
- package/src/frames/official/catering-order.json +79 -0
- package/src/frames/official/charging-prices.json +105 -0
- package/src/frames/official/charity-shop.json +75 -0
- package/src/frames/official/check-symptoms.json +80 -0
- package/src/frames/official/cheese-pairing.json +91 -0
- package/src/frames/official/chess-club.json +64 -0
- package/src/frames/official/chess-lessons.json +83 -0
- package/src/frames/official/choose-your-plan.json +113 -0
- package/src/frames/official/choose-your-wash.json +86 -0
- package/src/frames/official/clean-beauty.json +94 -0
- package/src/frames/official/click-and-collect.json +85 -0
- package/src/frames/official/clock-in.json +101 -0
- package/src/frames/official/club-fees.json +94 -0
- package/src/frames/official/coach-sign-up.json +108 -0
- package/src/frames/official/community-notices.json +107 -0
- package/src/frames/official/compare-specs.json +112 -0
- package/src/frames/official/consultation-form.json +120 -0
- package/src/frames/official/continued-online.json +81 -0
- package/src/frames/official/cookie-box.json +88 -0
- package/src/frames/official/cooking-class.json +89 -0
- package/src/frames/official/coworking-pass.json +89 -0
- package/src/frames/official/cricket-club.json +158 -0
- package/src/frames/official/cupcake-order.json +108 -0
- package/src/frames/official/damage-report.json +114 -0
- package/src/frames/official/dashboard-lights.json +106 -0
- package/src/frames/official/delivery-instructions.json +98 -0
- package/src/frames/official/diy-how-to.json +87 -0
- package/src/frames/official/donate-coats.json +74 -0
- package/src/frames/official/donate-food.json +80 -0
- package/src/frames/official/donation-jar.json +101 -0
- package/src/frames/official/donut-shop.json +94 -0
- package/src/frames/official/dress-fitting.json +64 -0
- package/src/frames/official/driving-lessons.json +110 -0
- package/src/frames/official/dumpling-house.json +82 -0
- package/src/frames/official/eye-exam.json +70 -0
- package/src/frames/official/eyewear-try-on.json +99 -0
- package/src/frames/official/fan-club.json +152 -0
- package/src/frames/official/farm-stand.json +109 -0
- package/src/frames/official/farmers-market.json +74 -0
- package/src/frames/official/find-a-charger.json +107 -0
- package/src/frames/official/find-a-doctor.json +85 -0
- package/src/frames/official/find-it-in-store.json +101 -0
- package/src/frames/official/find-our-office.json +80 -0
- package/src/frames/official/first-aid-guide.json +109 -0
- package/src/frames/official/fish-market.json +113 -0
- package/src/frames/official/fitness-challenge.json +1 -1
- package/src/frames/official/fitness-equipment.json +1 -1
- package/src/frames/official/fitness-kettlebell.json +1 -1
- package/src/frames/official/fitness-schedule.json +1 -1
- package/src/frames/official/fitness-test.json +94 -0
- package/src/frames/official/fitness-timer.json +1 -1
- package/src/frames/official/fitness-trial.json +1 -1
- package/src/frames/official/fitness-yoga.json +1 -1
- package/src/frames/official/food-support.json +102 -0
- package/src/frames/official/food-truck-location.json +80 -0
- package/src/frames/official/furnished-rental.json +101 -0
- package/src/frames/official/game-night.json +79 -0
- package/src/frames/official/garden-design.json +70 -0
- package/src/frames/official/garden-plot.json +74 -0
- package/src/frames/official/get-a-quote.json +113 -0
- package/src/frames/official/get-it-delivered.json +82 -0
- package/src/frames/official/get-started-rocket.json +80 -0
- package/src/frames/official/get-the-brochure.json +116 -0
- package/src/frames/official/gift-ideas.json +86 -0
- package/src/frames/official/gift-message.json +85 -0
- package/src/frames/official/give-blood.json +88 -0
- package/src/frames/official/giving-jar.json +89 -0
- package/src/frames/official/golf-scorecard.json +120 -0
- package/src/frames/official/grand-opening.json +158 -0
- package/src/frames/official/grill-menu.json +92 -0
- package/src/frames/official/hand-washing.json +106 -0
- package/src/frames/official/handyman.json +130 -0
- package/src/frames/official/hear-it-spoken.json +86 -0
- package/src/frames/official/home-valuation.json +87 -0
- package/src/frames/official/homework-help.json +79 -0
- package/src/frames/official/hot-shave.json +121 -0
- package/src/frames/official/house-rules.json +121 -0
- package/src/frames/official/how-it-works.json +98 -0
- package/src/frames/official/how-to-apply.json +93 -0
- package/src/frames/official/impact-report.json +90 -0
- package/src/frames/official/intake-forms.json +114 -0
- package/src/frames/official/join-a-league.json +94 -0
- package/src/frames/official/join-the-cleanup.json +110 -0
- package/src/frames/official/join-the-waitlist.json +102 -0
- package/src/frames/official/join-the-webinar.json +108 -0
- package/src/frames/official/juice-bar.json +70 -0
- package/src/frames/official/kids-haircuts.json +75 -0
- package/src/frames/official/kids-menu.json +107 -0
- package/src/frames/official/large-print.json +80 -0
- package/src/frames/official/lash-bar.json +86 -0
- package/src/frames/official/last-chance.json +94 -0
- package/src/frames/official/late-night-menu.json +77 -0
- package/src/frames/official/learn-the-signs.json +107 -0
- package/src/frames/official/library-card.json +90 -0
- package/src/frames/official/live-scores.json +101 -0
- package/src/frames/official/lost-and-found.json +85 -0
- package/src/frames/official/lost-pet-tag.json +84 -0
- package/src/frames/official/make-a-claim.json +74 -0
- package/src/frames/official/makeup-artist.json +94 -0
- package/src/frames/official/math-practice.json +136 -0
- package/src/frames/official/meal-plan.json +121 -0
- package/src/frames/official/meet-the-maker.json +91 -0
- package/src/frames/official/meet-the-team.json +82 -0
- package/src/frames/official/membership-card.json +108 -0
- package/src/frames/official/mortgage-calculator.json +94 -0
- package/src/frames/official/moving-checklist.json +108 -0
- package/src/frames/official/music-lessons.json +64 -0
- package/src/frames/official/nail-studio.json +70 -0
- package/src/frames/official/neighborhood-guide.json +98 -0
- package/src/frames/official/nutrition-facts.json +98 -0
- package/src/frames/official/online-class.json +82 -0
- package/src/frames/official/open-an-account.json +88 -0
- package/src/frames/official/open-house-sign-in.json +104 -0
- package/src/frames/official/parcel-room.json +98 -0
- package/src/frames/official/parent-meeting.json +108 -0
- package/src/frames/official/parking-permit.json +74 -0
- package/src/frames/official/pay-at-the-pump.json +108 -0
- package/src/frames/official/pay-for-parking.json +89 -0
- package/src/frames/official/pay-it-forward.json +102 -0
- package/src/frames/official/pay-your-rent.json +105 -0
- package/src/frames/official/permission-form.json +120 -0
- package/src/frames/official/personal-trainer.json +76 -0
- package/src/frames/official/physio-exercises.json +86 -0
- package/src/frames/official/pick-your-own.json +158 -0
- package/src/frames/official/plant-a-tree.json +88 -0
- package/src/frames/official/plant-based-menu.json +103 -0
- package/src/frames/official/plant-care.json +84 -0
- package/src/frames/official/podcast.json +107 -0
- package/src/frames/official/polling-place.json +109 -0
- package/src/frames/official/pool-timetable.json +113 -0
- package/src/frames/official/portfolio-card.json +110 -0
- package/src/frames/official/pre-order-bread.json +110 -0
- package/src/frames/official/press-kit.json +136 -0
- package/src/frames/official/price-list.json +111 -0
- package/src/frames/official/privacy-notice.json +115 -0
- package/src/frames/official/property-floor-plan.json +1 -1
- package/src/frames/official/property-for-sale.json +1 -1
- package/src/frames/official/property-house-light.json +1 -1
- package/src/frames/official/property-house.json +1 -1
- package/src/frames/official/property-key.json +1 -1
- package/src/frames/official/property-open-house.json +1 -1
- package/src/frames/official/property-rent.json +1 -1
- package/src/frames/official/property-virtual-tour.json +1 -1
- package/src/frames/official/questions-cloud.json +65 -0
- package/src/frames/official/race-entry.json +90 -0
- package/src/frames/official/race-photos.json +93 -0
- package/src/frames/official/rate-your-ride.json +103 -0
- package/src/frames/official/read-a-sample.json +108 -0
- package/src/frames/official/read-the-ebook.json +116 -0
- package/src/frames/official/read-the-faq.json +88 -0
- package/src/frames/official/read-the-reviews.json +110 -0
- package/src/frames/official/read-the-story.json +90 -0
- package/src/frames/official/read-the-transcript.json +142 -0
- package/src/frames/official/reading-challenge.json +97 -0
- package/src/frames/official/rebook-visit.json +86 -0
- package/src/frames/official/recipe-card.json +120 -0
- package/src/frames/official/refill-reminder.json +104 -0
- package/src/frames/official/register-interest.json +82 -0
- package/src/frames/official/register-to-vote.json +80 -0
- package/src/frames/official/renovation-quote.json +80 -0
- package/src/frames/official/rent-a-bike.json +95 -0
- package/src/frames/official/rent-this-item.json +95 -0
- package/src/frames/official/rental-car-guide.json +115 -0
- package/src/frames/official/report-a-problem.json +114 -0
- package/src/frames/official/report-a-repair.json +79 -0
- package/src/frames/official/report-a-street-issue.json +113 -0
- package/src/frames/official/request-maintenance.json +74 -0
- package/src/frames/official/resident-portal.json +98 -0
- package/src/frames/official/restaurant-gift-card.json +94 -0
- package/src/frames/official/restock-alert.json +98 -0
- package/src/frames/official/restroom-feedback.json +86 -0
- package/src/frames/official/return-your-cup.json +130 -0
- package/src/frames/official/return-your-rental.json +113 -0
- package/src/frames/official/ring-size.json +107 -0
- package/src/frames/official/roadside-help.json +92 -0
- package/src/frames/official/run-club.json +79 -0
- package/src/frames/official/safety-information.json +92 -0
- package/src/frames/official/salon-prices.json +92 -0
- package/src/frames/official/save-for-later.json +79 -0
- package/src/frames/official/scan-for-the-answer.json +86 -0
- package/src/frames/official/scan-for-the-checklist.json +108 -0
- package/src/frames/official/scan-for-the-latest.json +74 -0
- package/src/frames/official/scan-for-translations.json +108 -0
- package/src/frames/official/scan-here-arrow.json +76 -0
- package/src/frames/official/scan-here-post.json +89 -0
- package/src/frames/official/scan-me-banner.json +147 -0
- package/src/frames/official/scan-me-cloud.json +73 -0
- package/src/frames/official/scan-me-folded.json +74 -0
- package/src/frames/official/scan-me-stack.json +93 -0
- package/src/frames/official/scan-to-unlock.json +107 -0
- package/src/frames/official/scent-finder.json +94 -0
- package/src/frames/official/scholarships.json +108 -0
- package/src/frames/official/school-supply-list.json +80 -0
- package/src/frames/official/science-fair.json +89 -0
- package/src/frames/official/season-schedule.json +66 -0
- package/src/frames/official/see-more-stack.json +91 -0
- package/src/frames/official/see-our-pitch.json +85 -0
- package/src/frames/official/see-the-full-list.json +107 -0
- package/src/frames/official/see-the-map.json +79 -0
- package/src/frames/official/send-flowers.json +93 -0
- package/src/frames/official/service-times.json +115 -0
- package/src/frames/official/shade-finder.json +113 -0
- package/src/frames/official/shoe-size-check.json +95 -0
- package/src/frames/official/sign-rider.json +1 -1
- package/src/frames/official/sign-the-agreement.json +120 -0
- package/src/frames/official/sign-the-petition.json +120 -0
- package/src/frames/official/site-hoarding.json +158 -0
- package/src/frames/official/site-induction.json +120 -0
- package/src/frames/official/size-guide.json +80 -0
- package/src/frames/official/skate-park-rules.json +109 -0
- package/src/frames/official/skincare-routine.json +85 -0
- package/src/frames/official/sofa-fabric.json +84 -0
- package/src/frames/official/spa-gift.json +90 -0
- package/src/frames/official/spa-menu.json +124 -0
- package/src/frames/official/split-the-bill.json +77 -0
- package/src/frames/official/sponsor-a-pet.json +102 -0
- package/src/frames/official/sponsor-my-run.json +136 -0
- package/src/frames/official/sports-camp.json +142 -0
- package/src/frames/official/staff-handbook.json +121 -0
- package/src/frames/official/staff-rota.json +112 -0
- package/src/frames/official/start-a-return.json +92 -0
- package/src/frames/official/start-charging.json +104 -0
- package/src/frames/official/start-here-arrow.json +79 -0
- package/src/frames/official/start-saving.json +74 -0
- package/src/frames/official/storage-units.json +79 -0
- package/src/frames/official/student-portal.json +80 -0
- package/src/frames/official/style-gallery.json +111 -0
- package/src/frames/official/sushi-menu.json +115 -0
- package/src/frames/official/swim-lessons.json +70 -0
- package/src/frames/official/table-tennis.json +116 -0
- package/src/frames/official/take-a-closer-look.json +94 -0
- package/src/frames/official/takeout-order.json +98 -0
- package/src/frames/official/talk-to-someone.json +115 -0
- package/src/frames/official/talk-to-the-agent.json +115 -0
- package/src/frames/official/tea-menu.json +70 -0
- package/src/frames/official/tea-time.json +124 -0
- package/src/frames/official/team-jersey.json +77 -0
- package/src/frames/official/team-kit.json +85 -0
- package/src/frames/official/tee-time.json +85 -0
- package/src/frames/official/tennis-court.json +94 -0
- package/src/frames/official/test-drive.json +88 -0
- package/src/frames/official/test-results.json +85 -0
- package/src/frames/official/tire-change.json +74 -0
- package/src/frames/official/town-hall.json +158 -0
- package/src/frames/official/toy-finder.json +81 -0
- package/src/frames/official/trace-your-coffee.json +87 -0
- package/src/frames/official/trade-it-in.json +97 -0
- package/src/frames/official/try-the-demo.json +106 -0
- package/src/frames/official/unlock-this-car.json +82 -0
- package/src/frames/official/upload-receipts.json +108 -0
- package/src/frames/official/validate-parking.json +91 -0
- package/src/frames/official/vehicle-history.json +106 -0
- package/src/frames/official/virtual-try-on.json +93 -0
- package/src/frames/official/visiting-hours.json +90 -0
- package/src/frames/official/visitor-map.json +92 -0
- package/src/frames/official/visitor-sign-in.json +98 -0
- package/src/frames/official/volunteer.json +74 -0
- package/src/frames/official/vote-for-us.json +103 -0
- package/src/frames/official/walk-in-queue.json +102 -0
- package/src/frames/official/wash-club.json +81 -0
- package/src/frames/official/watch-repair.json +115 -0
- package/src/frames/official/watch-the-experiment.json +93 -0
- package/src/frames/official/water-refill.json +95 -0
- package/src/frames/official/weekly-deals.json +107 -0
- package/src/frames/official/wellness-retreat.json +85 -0
- package/src/frames/official/whats-inside.json +91 -0
- package/src/frames/official/wholesale.json +85 -0
- package/src/frames/official/window-quote.json +121 -0
- package/src/frames/official/wine-pairings.json +142 -0
- package/src/frames/official/wine-staff-pick.json +100 -0
- package/src/frames/official/winery-tasting.json +94 -0
- package/src/frames/official/yard-sign-coming-soon.json +115 -0
- package/src/frames/official/yard-sign-for-sale.json +150 -0
- package/src/frames/official/yard-sign-sold.json +162 -0
- package/src/frames/official/yard-sign-viewing.json +121 -0
- package/src/frames/official/your-prescription.json +107 -0
- package/src/frames/official/youth-club.json +104 -0
- package/src/frames/official-types.ts +6 -1
- package/src/frames/official.ts +4 -4
- package/src/index.tsx +6 -352
- package/src/jsx/index.ts +3 -0
- package/src/jsx/jsx-dev-runtime.ts +14 -0
- package/src/jsx/jsx-runtime.ts +34 -0
- package/src/jsx/runtime.ts +209 -0
- package/src/logo.tsx +5 -3
- package/src/node.ts +61 -0
- package/src/part-markers.ts +40 -0
- package/src/plain.tsx +194 -0
- package/src/qr-code-canvas.tsx +2 -1
- package/src/qr-code-props.ts +115 -0
- package/src/qr-code-svg.tsx +17 -0
- package/src/qr-code.tsx +34 -112
- package/src/rasterize.ts +282 -0
- package/src/react-elements.ts +13 -0
- package/src/render/attributes.ts +404 -0
- package/src/render/dom.ts +90 -0
- package/src/render/hyperscript.ts +66 -0
- package/src/render/string.ts +70 -0
- package/src/scan-score.ts +1 -1
- package/src/svg.ts +27 -0
- package/src/template/arrow.tsx +1 -0
- package/src/template/default.tsx +1 -0
- package/src/template/halloween.tsx +1 -0
- package/src/template/square-border.tsx +1 -0
- package/src/template/standard-box.tsx +1 -0
- package/src/template/striked-box.tsx +1 -0
- package/src/utils/print-shared.ts +1 -1
- package/src/utils.tsx +82 -38
- package/src/vanilla-api.ts +146 -0
- package/src/vanilla-browser.ts +11 -0
- package/src/vanilla.ts +10 -0
- package/src/vue.ts +220 -0
- package/types/index.ts +4 -2
- package/types/public.ts +4 -0
- package/types/qr.ts +24 -5
- package/types/react.ts +8 -0
- package/types/template.ts +10 -3
package/dist/qr-code-canvas.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{useEffect as mi,useRef as Un,useState as pi}from"react";var Lt;(u=>{class t{constructor(o,i,s,c){this.version=o;this.errorCorrectionLevel=i;if(o<t.MIN_VERSION||o>t.MAX_VERSION)throw new RangeError("Version value out of range");if(c<-1||c>7)throw new RangeError("Mask value out of range");this.size=o*4+17;let m=[];for(let f=0;f<this.size;f++)m.push(!1);for(let f=0;f<this.size;f++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();let p=this.addEccAndInterleave(s);if(this.drawCodewords(p),c==-1){let f=1e9;for(let d=0;d<8;d++){this.applyMask(d),this.drawFormatBits(d);let h=this.getPenaltyScore();h<f&&(c=d,f=h),this.applyMask(d)}}r(0<=c&&c<=7),this.mask=c,this.applyMask(c),this.drawFormatBits(c),this.isFunction=[]}version;errorCorrectionLevel;static encodeText(o,i){let s=u.QrSegment.makeSegments(o);return t.encodeSegments(s,i)}static encodeBinary(o,i){let s=u.QrSegment.makeBytes(o);return t.encodeSegments([s],i)}static encodeSegments(o,i,s=1,c=40,m=-1,p=!0){if(!(t.MIN_VERSION<=s&&s<=c&&c<=t.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let f,d;for(f=s;;f++){let y=t.getNumDataCodewords(f,i)*8,S=a.getTotalBits(o,f);if(S<=y){d=S;break}if(f>=c)throw new RangeError("Data too long")}for(let y of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])p&&d<=t.getNumDataCodewords(f,y)*8&&(i=y);let h=[];for(let y of o){e(y.mode.modeBits,4,h),e(y.numChars,y.mode.numCharCountBits(f),h);for(let S of y.getData())h.push(S)}r(h.length==d);let b=t.getNumDataCodewords(f,i)*8;r(h.length<=b),e(0,Math.min(4,b-h.length),h),e(0,(8-h.length%8)%8,h),r(h.length%8==0);for(let y=236;h.length<b;y^=253)e(y,8,h);let g=[];for(;g.length*8<h.length;)g.push(0);return h.forEach((y,S)=>g[S>>>3]|=y<<7-(S&7)),new t(f,i,g,m)}size;mask;modules=[];isFunction=[];getModule(o,i){return 0<=o&&o<this.size&&0<=i&&i<this.size&&this.modules[i][o]}getModules(){return this.modules}drawFunctionPatterns(){for(let s=0;s<this.size;s++)this.setFunctionModule(6,s,s%2==0),this.setFunctionModule(s,6,s%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let o=this.getAlignmentPatternPositions(),i=o.length;for(let s=0;s<i;s++)for(let c=0;c<i;c++)s==0&&c==0||s==0&&c==i-1||s==i-1&&c==0||this.drawAlignmentPattern(o[s],o[c]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(o){let i=this.errorCorrectionLevel.formatBits<<3|o,s=i;for(let m=0;m<10;m++)s=s<<1^(s>>>9)*1335;let c=(i<<10|s)^21522;r(c>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,n(c,m));this.setFunctionModule(8,7,n(c,6)),this.setFunctionModule(8,8,n(c,7)),this.setFunctionModule(7,8,n(c,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,n(c,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,n(c,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,n(c,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let o=this.version;for(let s=0;s<12;s++)o=o<<1^(o>>>11)*7973;let i=this.version<<12|o;r(i>>>18==0);for(let s=0;s<18;s++){let c=n(i,s),m=this.size-11+s%3,p=Math.floor(s/3);this.setFunctionModule(m,p,c),this.setFunctionModule(p,m,c)}}drawFinderPattern(o,i){for(let s=-4;s<=4;s++)for(let c=-4;c<=4;c++){let m=Math.max(Math.abs(c),Math.abs(s)),p=o+c,f=i+s;0<=p&&p<this.size&&0<=f&&f<this.size&&this.setFunctionModule(p,f,m!=2&&m!=4)}}drawAlignmentPattern(o,i){for(let s=-2;s<=2;s++)for(let c=-2;c<=2;c++)this.setFunctionModule(o+c,i+s,Math.max(Math.abs(c),Math.abs(s))!=1)}setFunctionModule(o,i,s){this.modules[i][o]=s,this.isFunction[i][o]=!0}addEccAndInterleave(o){let i=this.version,s=this.errorCorrectionLevel;if(o.length!=t.getNumDataCodewords(i,s))throw new RangeError("Invalid argument");let c=t.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][i],m=t.ECC_CODEWORDS_PER_BLOCK[s.ordinal][i],p=Math.floor(t.getNumRawDataModules(i)/8),f=c-p%c,d=Math.floor(p/c),h=[],b=t.reedSolomonComputeDivisor(m);for(let y=0,S=0;y<c;y++){let E=o.slice(S,S+d-m+(y<f?0:1));S+=E.length;let P=t.reedSolomonComputeRemainder(E,b);y<f&&E.push(0),h.push(E.concat(P))}let g=[];for(let y=0;y<h[0].length;y++)h.forEach((S,E)=>{(y!=d-m||E>=f)&&g.push(S[y])});return r(g.length==p),g}drawCodewords(o){if(o.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let i=0;for(let s=this.size-1;s>=1;s-=2){s==6&&(s=5);for(let c=0;c<this.size;c++)for(let m=0;m<2;m++){let p=s-m,d=(s+1&2)==0?this.size-1-c:c;!this.isFunction[d][p]&&i<o.length*8&&(this.modules[d][p]=n(o[i>>>3],7-(i&7)),i++)}}r(i==o.length*8)}applyMask(o){if(o<0||o>7)throw new RangeError("Mask value out of range");for(let i=0;i<this.size;i++)for(let s=0;s<this.size;s++){let c;switch(o){case 0:c=(s+i)%2==0;break;case 1:c=i%2==0;break;case 2:c=s%3==0;break;case 3:c=(s+i)%3==0;break;case 4:c=(Math.floor(s/3)+Math.floor(i/2))%2==0;break;case 5:c=s*i%2+s*i%3==0;break;case 6:c=(s*i%2+s*i%3)%2==0;break;case 7:c=((s+i)%2+s*i%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[i][s]&&c&&(this.modules[i][s]=!this.modules[i][s])}}getPenaltyScore(){let o=0;for(let m=0;m<this.size;m++){let p=!1,f=0,d=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[m][h]==p?(f++,f==5?o+=t.PENALTY_N1:f>5&&o++):(this.finderPenaltyAddHistory(f,d),p||(o+=this.finderPenaltyCountPatterns(d)*t.PENALTY_N3),p=this.modules[m][h],f=1);o+=this.finderPenaltyTerminateAndCount(p,f,d)*t.PENALTY_N3}for(let m=0;m<this.size;m++){let p=!1,f=0,d=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][m]==p?(f++,f==5?o+=t.PENALTY_N1:f>5&&o++):(this.finderPenaltyAddHistory(f,d),p||(o+=this.finderPenaltyCountPatterns(d)*t.PENALTY_N3),p=this.modules[h][m],f=1);o+=this.finderPenaltyTerminateAndCount(p,f,d)*t.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let p=0;p<this.size-1;p++){let f=this.modules[m][p];f==this.modules[m][p+1]&&f==this.modules[m+1][p]&&f==this.modules[m+1][p+1]&&(o+=t.PENALTY_N2)}let i=0;for(let m of this.modules)i=m.reduce((p,f)=>p+(f?1:0),i);let s=this.size*this.size,c=Math.ceil(Math.abs(i*20-s*10)/s)-1;return r(0<=c&&c<=9),o+=c*t.PENALTY_N4,r(0<=o&&o<=2568888),o}getAlignmentPatternPositions(){if(this.version==1)return[];{let o=Math.floor(this.version/7)+2,i=this.version==32?26:Math.ceil((this.version*4+4)/(o*2-2))*2,s=[6];for(let c=this.size-7;s.length<o;c-=i)s.splice(1,0,c);return s}}static getNumRawDataModules(o){if(o<t.MIN_VERSION||o>t.MAX_VERSION)throw new RangeError("Version number out of range");let i=(16*o+128)*o+64;if(o>=2){let s=Math.floor(o/7)+2;i-=(25*s-10)*s-55,o>=7&&(i-=36)}return r(208<=i&&i<=29648),i}static getNumDataCodewords(o,i){return Math.floor(t.getNumRawDataModules(o)/8)-t.ECC_CODEWORDS_PER_BLOCK[i.ordinal][o]*t.NUM_ERROR_CORRECTION_BLOCKS[i.ordinal][o]}static reedSolomonComputeDivisor(o){if(o<1||o>255)throw new RangeError("Degree out of range");let i=[];for(let c=0;c<o-1;c++)i.push(0);i.push(1);let s=1;for(let c=0;c<o;c++){for(let m=0;m<i.length;m++)i[m]=t.reedSolomonMultiply(i[m],s),m+1<i.length&&(i[m]^=i[m+1]);s=t.reedSolomonMultiply(s,2)}return i}static reedSolomonComputeRemainder(o,i){let s=i.map(c=>0);for(let c of o){let m=c^s.shift();s.push(0),i.forEach((p,f)=>s[f]^=t.reedSolomonMultiply(p,m))}return s}static reedSolomonMultiply(o,i){if(o>>>8||i>>>8)throw new RangeError("Byte out of range");let s=0;for(let c=7;c>=0;c--)s=s<<1^(s>>>7)*285,s^=(i>>>c&1)*o;return r(s>>>8==0),s}finderPenaltyCountPatterns(o){let i=o[1];r(i<=this.size*3);let s=i>0&&o[2]==i&&o[3]==i*3&&o[4]==i&&o[5]==i;return(s&&o[0]>=i*4&&o[6]>=i?1:0)+(s&&o[6]>=i*4&&o[0]>=i?1:0)}finderPenaltyTerminateAndCount(o,i,s){return o&&(this.finderPenaltyAddHistory(i,s),i=0),i+=this.size,this.finderPenaltyAddHistory(i,s),this.finderPenaltyCountPatterns(s)}finderPenaltyAddHistory(o,i){i[0]==0&&(o+=this.size),i.pop(),i.unshift(o)}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}u.QrCode=t;function e(l,o,i){if(o<0||o>31||l>>>o)throw new RangeError("Value out of range");for(let s=o-1;s>=0;s--)i.push(l>>>s&1)}function n(l,o){return(l>>>o&1)!=0}function r(l){if(!l)throw new Error("Assertion error")}class a{constructor(o,i,s){this.mode=o;this.numChars=i;this.bitData=s;if(i<0)throw new RangeError("Invalid argument");this.bitData=s.slice()}mode;numChars;bitData;static makeBytes(o){let i=[];for(let s of o)e(s,8,i);return new a(a.Mode.BYTE,o.length,i)}static makeNumeric(o){if(!a.isNumeric(o))throw new RangeError("String contains non-numeric characters");let i=[];for(let s=0;s<o.length;){let c=Math.min(o.length-s,3);e(parseInt(o.substr(s,c),10),c*3+1,i),s+=c}return new a(a.Mode.NUMERIC,o.length,i)}static makeAlphanumeric(o){if(!a.isAlphanumeric(o))throw new RangeError("String contains unencodable characters in alphanumeric mode");let i=[],s;for(s=0;s+2<=o.length;s+=2){let c=a.ALPHANUMERIC_CHARSET.indexOf(o.charAt(s))*45;c+=a.ALPHANUMERIC_CHARSET.indexOf(o.charAt(s+1)),e(c,11,i)}return s<o.length&&e(a.ALPHANUMERIC_CHARSET.indexOf(o.charAt(s)),6,i),new a(a.Mode.ALPHANUMERIC,o.length,i)}static makeSegments(o){return o==""?[]:a.isNumeric(o)?[a.makeNumeric(o)]:a.isAlphanumeric(o)?[a.makeAlphanumeric(o)]:[a.makeBytes(a.toUtf8ByteArray(o))]}static makeEci(o){let i=[];if(o<0)throw new RangeError("ECI assignment value out of range");if(o<128)e(o,8,i);else if(o<16384)e(2,2,i),e(o,14,i);else if(o<1e6)e(6,3,i),e(o,21,i);else throw new RangeError("ECI assignment value out of range");return new a(a.Mode.ECI,0,i)}static isNumeric(o){return a.NUMERIC_REGEX.test(o)}static isAlphanumeric(o){return a.ALPHANUMERIC_REGEX.test(o)}getData(){return this.bitData.slice()}static getTotalBits(o,i){let s=0;for(let c of o){let m=c.mode.numCharCountBits(i);if(c.numChars>=1<<m)return 1/0;s+=4+m+c.bitData.length}return s}static toUtf8ByteArray(o){o=encodeURI(o);let i=[];for(let s=0;s<o.length;s++)o.charAt(s)!="%"?i.push(o.charCodeAt(s)):(i.push(parseInt(o.substr(s+1,2),16)),s+=2);return i}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}u.QrSegment=a})(Lt||={});(e=>{let t;(r=>{class n{constructor(u,l){this.ordinal=u;this.formatBits=l}ordinal;formatBits;static LOW=new n(0,1);static MEDIUM=new n(1,0);static QUARTILE=new n(2,3);static HIGH=new n(3,2)}r.Ecc=n})(t=e.QrCode||={})})(Lt||={});(e=>{let t;(r=>{class n{constructor(u,l){this.modeBits=u;this.numBitsCharCount=l}modeBits;numBitsCharCount;static NUMERIC=new n(1,[10,12,14]);static ALPHANUMERIC=new n(2,[9,11,13]);static BYTE=new n(4,[8,16,16]);static KANJI=new n(8,[8,10,12]);static ECI=new n(7,[0,0,0]);numCharCountBits(u){return this.numBitsCharCount[Math.floor((u+7)/17)]}}r.Mode=n})(t=e.QrSegment||={})})(Lt||={});var H=Lt;var ct={L:H.QrCode.Ecc.LOW,M:H.QrCode.Ecc.MEDIUM,Q:H.QrCode.Ecc.QUARTILE,H:H.QrCode.Ecc.HIGH},Qt=128,At="Q",tt="#FFFFFF",Xt="#000000";var Vt=0;var jt=.1;import oa from"react";import{z as lt}from"zod";var Xn=["none","banner-bottom","banner-top","border","rounded-border","speech-bubble","banner-top-bottom","speech-bubble-top","chat-bubble","circle","polaroid","phone","ticket","badge","envelope","tag","menu-card","sticker","gradient-border","focus"],et=24,Oe="Scan me",Nt=.5,bt=1.5,Vn=lt.enum(Xn),me=lt.object({style:Vn,text:lt.string().max(et).optional(),color:lt.string().optional(),textColor:lt.string().optional(),secondaryText:lt.string().max(et).optional(),secondaryColor:lt.string().optional(),fontScale:lt.number().min(Nt).max(bt).optional()});import{z as C}from"zod";function Wt(t,e=3){let n=10**e;return Math.round(t*n)/n+0}function x(t,e=3){return String(Wt(t,e))}function q(t,...e){let n=t[0]??"";for(let r=0;r<e.length;r++){let a=e[r];n+=(typeof a=="number"?x(a):a)+(t[r+1]??"")}return n}var jn={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Wn=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,pe=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function Zt(t,e=Number.POSITIVE_INFINITY){if(!Wn.test(t))return null;let n=[],r=0,a=()=>{for(;r<t.length&&/[\s,]/.test(t[r]);)r++},u=()=>{a(),pe.lastIndex=r;let i=pe.exec(t);if(!i)return null;let s=i[0],c=s.indexOf(".");if(c>=0&&s.length-c-1>e)return null;r=pe.lastIndex;let m=Number(s);return Number.isFinite(m)?m:null},l=()=>{a();let i=t[r];return i==="0"||i==="1"?(r++,i==="1"?1:0):null},o=()=>(a(),r<t.length&&/[0-9.+-]/.test(t[r]));for(a();r<t.length;){let i=t[r],s=i.toUpperCase(),c=jn[s];if(c===void 0||n.length===0&&s!=="M")return null;if(r++,c===0){n.push({command:i,values:[]}),a();continue}let m=i,p=!0;for(;p||o();){let f=[];for(let d=0;d<c;d++){let h=s==="A"&&(d===3||d===4)?l():u();if(h===null)return null;f.push(h)}n.push({command:m,values:f}),s==="M"&&(m=i==="M"?"L":"l"),p=!1}a()}return n}function qe(t){let e=0;for(let{command:n}of t)e+=n.toUpperCase()==="A"?4:1;return e}function ze(t,e=1,n=0,r=0){let a="";for(let{command:u,values:l}of t){let o=u.toUpperCase(),i=u===o,s=i?n:0,c=i?r:0,m;switch(o){case"Z":m=[];break;case"H":m=[x(l[0]*e+s)];break;case"V":m=[x(l[0]*e+c)];break;case"A":m=[x(Math.abs(l[0])*e),x(Math.abs(l[1])*e),x(l[2]),String(l[3]),String(l[4]),x(l[5]*e+s),x(l[6]*e+c)];break;default:m=l.map((p,f)=>x(p*e+(f%2===0?s:c)))}a+=u+m.join(" ")}return a}function ke(t,e=.25){let n=[],r=[],a=[0,0],u=[0,0],l=()=>{r.length>2&&n.push(r),r=[]};for(let o of t)if(o.op==="M")l(),a=[o.x,o.y],u=a,r.push(a);else if(o.op==="L")u=[o.x,o.y],r.push(u);else if(o.op==="C"){let i=u,s=[o.x1,o.y1],c=[o.x2,o.y2],m=[o.x,o.y],p=Math.hypot(s[0]-i[0],s[1]-i[1])+Math.hypot(c[0]-s[0],c[1]-s[1])+Math.hypot(m[0]-c[0],m[1]-c[1]),f=Math.max(2,Math.min(64,Math.ceil(Math.sqrt(p/(4*e)))));for(let d=1;d<=f;d++){let h=d/f,b=1-h;r.push([b*b*b*i[0]+3*b*b*h*s[0]+3*b*h*h*c[0]+h*h*h*m[0],b*b*b*i[1]+3*b*b*h*s[1]+3*b*h*h*c[1]+h*h*h*m[1]])}u=m}else l(),u=a;return l(),n}function Be(t,e){let n=[a=>a[0]-e.x0,a=>e.x1-a[0],a=>a[1]-e.y0,a=>e.y1-a[1]],r=t;for(let a of n){if(r.length===0)break;let u=r;r=[];for(let l=0;l<u.length;l++){let o=u[l],i=u[(l+u.length-1)%u.length],s=a(o),c=a(i);s>=0?(c<0&&r.push(De(i,o,c,s)),r.push(o)):c>=0&&r.push(De(i,o,c,s))}}return r.length>2?r:[]}function De(t,e,n,r){let a=n/(n-r);return[t[0]+(e[0]-t[0])*a,t[1]+(e[1]-t[1])*a]}function Ge(t){return t.filter(e=>e.length>2).map(e=>`M${e.map(([n,r])=>`${x(n)} ${x(r)}`).join("L")}Z`).join("")}function Ue(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY,u=(l,o)=>{e=Math.min(e,l),n=Math.min(n,o),r=Math.max(r,l),a=Math.max(a,o)};for(let l of t)l.op==="C"?(u(l.x1,l.y1),u(l.x2,l.y2),u(l.x,l.y)):l.op!=="Z"&&u(l.x,l.y);return Number.isFinite(e)?{x0:e,y0:n,x1:r,y1:a}:null}var fe=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function Zn(t,e,n,r,a,u,l,o,i){if(t===o&&e===i)return[];let s=Math.abs(n),c=Math.abs(r);if(s===0||c===0)return[{op:"L",x:o,y:i}];let m=a*Math.PI/180,p=Math.cos(m),f=Math.sin(m),d=(t-o)/2,h=(e-i)/2,b=p*d+f*h,g=-f*d+p*h,y=b*b/(s*s)+g*g/(c*c);y>1&&(s*=Math.sqrt(y),c*=Math.sqrt(y));let S=s*s*c*c-s*s*g*g-c*c*b*b,E=s*s*g*g+c*c*b*b,P=(u===l?-1:1)*Math.sqrt(Math.max(0,S/E)),M=P*s*g/c,L=-P*c*b/s,w=p*M-f*L+(t+o)/2,_=f*M+p*L+(e+i)/2,O=(j,Y,W,dt)=>Math.atan2(j*dt-Y*W,j*W+Y*dt),K=O(1,0,(b-M)/s,(g-L)/c),X=O((b-M)/s,(g-L)/c,(-b-M)/s,(-g-L)/c);!l&&X>0?X-=2*Math.PI:l&&X<0&&(X+=2*Math.PI);let U=Math.max(1,Math.ceil(Math.abs(X)/(Math.PI/2)-1e-9)),Z=X/U,at=4/3*Math.tan(Z/4),ft=(j,Y)=>[w+s*p*j-c*f*Y,_+s*f*j+c*p*Y],It=[];for(let j=0;j<U;j++){let Y=K+j*Z,W=Y+Z,[dt,wt]=ft(Math.cos(Y)-at*Math.sin(Y),Math.sin(Y)+at*Math.cos(Y)),[v,J]=ft(Math.cos(W)+at*Math.sin(W),Math.sin(W)-at*Math.cos(W)),[st,vt]=j===U-1?[o,i]:ft(Math.cos(W),Math.sin(W));It.push({op:"C",x1:dt,y1:wt,x2:v,y2:J,x:st,y:vt})}return It}function Jt(t){let e=[],n=0,r=0,a=0,u=0,l=0,o="",i=null,s=null,c=()=>{for(;n<t.length&&/[\s,]/.test(t[n]);)n++},m=()=>{c(),fe.lastIndex=n;let d=fe.exec(t);return d?(n=fe.lastIndex,Number(d[0])):null},p=()=>{c();let d=t[n];return d==="0"||d==="1"?(n++,d==="1"):null},f=d=>{let h=[];for(let b=0;b<d;b++){let g=m();if(g===null)return null;h.push(g)}return h};for(;c(),!(n>=t.length);){let d=t[n];if(/[MmLlHhVvCcSsQqTtAaZz]/.test(d))o=d,n++;else if(!o||o==="Z"||o==="z")break;let h=o===o.toLowerCase(),b=h?r:0,g=h?a:0,y=o.toUpperCase();if(y==="Z"){e.push({op:"Z"}),r=u,a=l,i=null,s=null;continue}if(y==="A"){let M=f(3),L=p(),w=p(),_=f(2);if(!(M&&_)||L===null||w===null)break;let[O,K,X]=M,U=_[0]+b,Z=_[1]+g;e.push(...Zn(r,a,O,K,X,L,w,U,Z)),r=U,a=Z,i=null,s=null;continue}let S={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2}[y]??0,E=f(S);if(!E)break;let P=E;switch(y){case"M":r=P[0]+b,a=P[1]+g,u=r,l=a,e.push({op:"M",x:r,y:a}),o=h?"l":"L",i=null,s=null;break;case"L":case"H":case"V":y!=="V"&&(r=P[0]+b),y==="V"?a=P[0]+g:y==="L"&&(a=P[1]+g),e.push({op:"L",x:r,y:a}),i=null,s=null;break;case"C":case"S":{let M,L;y==="C"?(M=[P[0]+b,P[1]+g],L=P.slice(2)):(M=i?[2*r-i[0],2*a-i[1]]:[r,a],L=P);let w=[L[0]+b,L[1]+g],_=[L[2]+b,L[3]+g];e.push({op:"C",x1:M[0],y1:M[1],x2:w[0],y2:w[1],x:_[0],y:_[1]}),[r,a]=_,i=w,s=null;break}case"Q":case"T":{let M,L;y==="Q"?(M=[P[0]+b,P[1]+g],L=[P[2]+b,P[3]+g]):(M=s?[2*r-s[0],2*a-s[1]]:[r,a],L=[P[0]+b,P[1]+g]),e.push({op:"C",x1:r+2/3*(M[0]-r),y1:a+2/3*(M[1]-a),x2:L[0]+2/3*(M[0]-L[0]),y2:L[1]+2/3*(M[1]-L[1]),x:L[0],y:L[1]}),[r,a]=L,s=M,i=null;break}default:break}}return e}var Ye=.5522847498;function de(t,e,n,r,a=0,u=0){if(n<=0||r<=0)return[];let l=Math.min(Math.max(a,0),n/2),o=Math.min(Math.max(u,0),r/2);if(l===0||o===0)return[{op:"M",x:t,y:e},{op:"L",x:t+n,y:e},{op:"L",x:t+n,y:e+r},{op:"L",x:t,y:e+r},{op:"Z"}];let i=l*Ye,s=o*Ye,c=t+n,m=e+r;return[{op:"M",x:t+l,y:e},{op:"L",x:c-l,y:e},{op:"C",x1:c-l+i,y1:e,x2:c,y2:e+o-s,x:c,y:e+o},{op:"L",x:c,y:m-o},{op:"C",x1:c,y1:m-o+s,x2:c-l+i,y2:m,x:c-l,y:m},{op:"L",x:t+l,y:m},{op:"C",x1:t+l-i,y1:m,x2:t,y2:m-o+s,x:t,y:m-o},{op:"L",x:t,y:e+o},{op:"C",x1:t,y1:e+o-s,x2:t+l-i,y2:e,x:t+l,y:e},{op:"Z"}]}var Jn="qrdx.frame",Kn=1,be="custom",N={minArtboard:50,maxArtboard:2e3,maxCoordinate:4e3,maxDecimals:3,maxShapes:64,maxLabels:8,maxPolygonPoints:256,maxPathLength:16e3,maxSegments:2e3,maxGradientSteps:64,maxGradientWork:16e3,maxBytes:32768,minQrShare:.5,minPadding:.04,defaultPadding:.08,maxTextLength:et},tr=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],ye=.95,er=200,nr=["frame","text","accent","background"],rr=/[\t\n\v\f\r\u0085\u2028\u2029]/g,or=/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180f\u200b-\u200f\u202a-\u202e\u2060-\u206f\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff0-\ufffb]|\udb40[\udc00-\udcff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;function xe(t,e=et){let n=t.slice(0,1e3).normalize("NFC").replace(rr," ").replace(or,"").replace(/\s+/g," ").trim();return Array.from(n).slice(0,Math.max(0,e)).join("").trim()}var Se=t=>Math.abs(t*1e3-Math.round(t*1e3))<1e-6,T=C.number().min(-N.maxCoordinate).max(N.maxCoordinate).refine(Se,{message:`Numbers may have at most ${N.maxDecimals} decimals`}),B=T.refine(t=>t>0,{message:"Must be greater than 0"}),te=T.refine(t=>t>=0,{message:"Must not be negative"}),Kt=C.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color"),he=C.union([C.enum(nr),Kt]),Ot=C.union([he,C.object({mix:C.tuple([he,he]),amount:C.number().min(0).max(1).refine(Se)}).strict()]),yt=C.union([Ot,C.object({gradient:C.object({from:Ot,to:Ot,direction:C.enum(["horizontal","vertical"]).optional(),steps:C.int().min(2).max(N.maxGradientSteps).optional()}).strict()}).strict()]),ge={x:T,y:T,width:B,height:B},ir=C.object({type:C.literal("rect"),...ge,radius:te.optional(),fill:yt,hole:C.object({...ge,radius:te.optional()}).strict().optional()}).strict(),ar=C.object({type:C.literal("circle"),cx:T,cy:T,r:B,hole:B.optional(),fill:yt}).strict(),sr=C.object({type:C.literal("ellipse"),cx:T,cy:T,rx:B,ry:B,fill:yt}).strict(),cr=C.object({type:C.literal("polygon"),points:C.array(C.tuple([T,T])).min(3).max(N.maxPolygonPoints),fill:yt}).strict(),lr=C.object({type:C.literal("path"),d:C.string().min(2).max(N.maxPathLength),fill:yt,fillRule:C.enum(["nonzero","evenodd"]).optional()}).strict(),ur=C.object({type:C.literal("line"),x1:T,y1:T,x2:T,y2:T,width:B,cap:C.enum(["butt","round"]).optional(),dash:C.tuple([B,B]).optional(),fill:yt}).strict(),mr=C.object({type:C.literal("icon"),icon:C.enum(tr),x:T,y:T,size:B,fill:yt}).strict(),pr=C.discriminatedUnion("type",[ir,ar,sr,cr,lr,ur,mr]),Qe={id:C.string().regex(/^[a-z][a-z0-9-]{0,31}$/),slot:C.enum(["primary","secondary","fixed"]),text:C.string().max(200),maxLength:C.int().min(1).max(et).optional(),color:Ot,weight:C.enum(["bold","regular"]).optional()},fr=C.object({type:C.literal("text"),...Qe,box:C.object(ge).strict(),align:C.enum(["start","middle","end"]).optional(),fontSize:B.optional()}).strict(),dr=C.object({type:C.literal("curved"),...Qe,curve:C.object({cx:T,cy:T,radius:B,side:C.enum(["top","bottom"]),spread:C.number().min(20).max(300).refine(Se).optional()}).strict(),fontSize:B}).strict(),hr=C.discriminatedUnion("type",[fr,dr]),He=T.refine(t=>t>=N.minArtboard&&t<=N.maxArtboard,{message:`Artboard sides must be ${N.minArtboard} to ${N.maxArtboard} units`}),gr=C.object({kind:C.literal(Jn),version:C.literal(Kn),artboard:C.object({width:He,height:He}).strict(),qr:C.object({x:T,y:T,size:B,padding:te.optional(),radius:te.optional()}).strict(),colors:C.object({frame:Kt,text:Kt.optional(),accent:Kt.optional()}).strict(),shapes:C.array(pr).max(N.maxShapes),labels:C.array(hr).max(N.maxLabels),bleed:C.union([C.literal("none"),Ot]).optional()}).strict();function br(t){let e=ee(t);return{x0:t.qr.x-e,y0:t.qr.y-e,x1:t.qr.x+t.qr.size+e,y1:t.qr.y+t.qr.size+e}}function ee(t){return t.qr.padding??t.qr.size*N.defaultPadding}var yr=(t,e)=>Math.min(t.x1,e.x1)-Math.max(t.x0,e.x0)>1e-6&&Math.min(t.y1,e.y1)-Math.max(t.y0,e.y0)>1e-6;function xr(t){switch(t.type){case"rect":return{bounds:{x0:t.x,y0:t.y,x1:t.x+t.width,y1:t.y+t.height},segments:t.hole?18:9};case"circle":return{bounds:{x0:t.cx-t.r,y0:t.cy-t.r,x1:t.cx+t.r,y1:t.cy+t.r},segments:t.hole?10:5};case"ellipse":return{bounds:{x0:t.cx-t.rx,y0:t.cy-t.ry,x1:t.cx+t.rx,y1:t.cy+t.ry},segments:5};case"polygon":{let e=t.points.map(([r])=>r),n=t.points.map(([,r])=>r);return{bounds:{x0:Math.min(...e),y0:Math.min(...n),x1:Math.max(...e),y1:Math.max(...n)},segments:t.points.length}}case"path":{let e=Zt(t.d,N.maxDecimals);return e?{bounds:Ue(Jt(t.d)),segments:qe(e)}:{bounds:null,segments:0}}case"line":{let e=t.width/2,n=Math.hypot(t.x2-t.x1,t.y2-t.y1),r=t.dash?Math.ceil(n/(t.dash[0]+t.dash[1])):1;return{bounds:{x0:Math.min(t.x1,t.x2)-e,y0:Math.min(t.y1,t.y2)-e,x1:Math.max(t.x1,t.x2)+e,y1:Math.max(t.y1,t.y2)+e},segments:r*(t.cap==="round"?4:5)}}default:return{bounds:{x0:t.x,y0:t.y,x1:t.x+t.size,y1:t.y+t.size},segments:er}}}function Sr(t,e){let n=(g,y=[])=>e.addIssue({code:"custom",message:g,path:y}),r=N,a=new TextEncoder().encode(JSON.stringify(t)).length;if(a>r.maxBytes){n(`The spec is ${a} bytes; the limit is ${r.maxBytes}`);return}let{width:u,height:l}=t.artboard,o=Math.max(u,l)*.005,i={x0:-o,y0:-o,x1:u+o,y1:l+o},s=g=>g.x0>=i.x0&&g.y0>=i.y0&&g.x1<=i.x1&&g.y1<=i.y1,{qr:c}=t,m=ee(t);m<c.size*r.minPadding-1e-9&&n(`qr.padding must be at least ${r.minPadding*100}% of qr.size`,["qr","padding"]),c.size<Math.min(u,l)*r.minQrShare-1e-9&&n(`qr.size must be at least ${r.minQrShare*100}% of the artboard's shorter side`,["qr","size"]);let p=br(t);(p.x0<-1e-9||p.y0<-1e-9||p.x1>u+1e-9||p.y1>l+1e-9)&&n("The code and its padding must sit inside the artboard",["qr"]),(c.radius??0)>(c.size+2*m)/2&&n("qr.radius is larger than half the plate",["qr","radius"]);let f=0,d=0;t.shapes.forEach((g,y)=>{let S=["shapes",y],{bounds:E,segments:P}=xr(g);if(!E){n("Path data must use only M L H V C S Q T A Z, plain numbers (up to 3 decimals) and start with M",[...S,"d"]);return}if(s(E)||n("The shape extends outside the artboard",S),g.type==="rect"&&g.hole){let{hole:M}=g;(M.x<g.x||M.y<g.y||M.x+M.width>g.x+g.width+1e-9||M.y+M.height>g.y+g.height+1e-9)&&n("The hole must sit inside its rect",[...S,"hole"])}g.type==="circle"&&g.hole&&g.hole>=g.r&&n("The hole must be smaller than the circle",[...S,"hole"]),f+=P,typeof g.fill=="object"&&"gradient"in g.fill&&(d+=(g.fill.gradient.steps??32)*P)}),f>r.maxSegments&&n(`The shapes have ${f} segments; the limit is ${r.maxSegments}`,["shapes"]),d>r.maxGradientWork&&n("Gradient fills are too detailed (fewer steps or simpler shapes)",["shapes"]);let h=new Set,b=new Set;t.labels.forEach((g,y)=>{let S=["labels",y];h.has(g.id)&&n(`Label id "${g.id}" is used twice`,[...S,"id"]),h.add(g.id),g.slot!=="fixed"&&(b.has(g.slot)&&n(`Only one label may use the ${g.slot} slot`,[...S,"slot"]),b.add(g.slot));let E=g.maxLength??r.maxTextLength;g.text!==xe(g.text,E)&&n(`Label text must be at most ${E} characters, trimmed, with no control or invisible characters (see sanitizeFrameText)`,[...S,"text"]);let P;if(g.type==="text")P={x0:g.box.x,y0:g.box.y,x1:g.box.x+g.box.width,y1:g.box.y+g.box.height},g.fontSize!==void 0&&g.fontSize>g.box.height*ye+1e-9&&n("fontSize may be at most 95% of the label's row height",[...S,"fontSize"]),yr(P,p)&&n("The label overlaps the code or its padding",[...S,"box"]);else{let{cx:M,cy:L,radius:w}=g.curve,_=g.fontSize*bt*.6;P={x0:M-w-_,y0:L-w-_,x1:M+w+_,y1:L+w+_};let O=Math.hypot(Math.max(p.x0-M,0,M-p.x1),Math.max(p.y0-L,0,L-p.y1));Math.hypot(Math.max(Math.abs(p.x0-M),Math.abs(p.x1-M)),Math.max(Math.abs(p.y0-L),Math.abs(p.y1-L)))<=w-_||O>=w+_||n("The curved label crosses the code or its padding",[...S,"curve"])}s(P)||n("The label extends outside the artboard",S)})}var Ee=gr.superRefine(Sr);var Er=me.extend({style:C.literal(be),spec:Ee}),Xe=C.discriminatedUnion("style",[me,Er]);function G(t){if(t.length===0)return"";let[e,...n]=t;return`M${x(e[0])} ${x(e[1])}${n.map(([r,a])=>`L${x(r)} ${x(a)}`).join("")}Z`}function $(t,e,n){return`M${x(t-n)} ${x(e)}A${x(n)} ${x(n)} 0 1 1 ${x(t+n)} ${x(e)}A${x(n)} ${x(n)} 0 1 1 ${x(t-n)} ${x(e)}Z`}function R(t,e,n,r,a=0){let u=Math.min(n,r)/2,[l,o,i,s]=(typeof a=="number"?[a,a,a,a]:a).map(m=>Math.max(0,Math.min(m,u))),c=(m,p,f)=>m>0?`A${x(m)} ${x(m)} 0 0 1 ${x(p)} ${x(f)}`:"";return`M${x(t+l)} ${x(e)}H${x(t+n-o)}${c(o,t+n,e+o)}V${x(e+r-i)}${c(i,t+n-i,e+r)}H${x(t+s)}${c(s,t,e+r-s)}V${x(e+l)}${c(l,t+l,e)}Z`}function ne(t,e,n,r,a=5){return Array.from({length:a*2},(u,l)=>{let o=l%2===0?n:r,i=-Math.PI/2+Math.PI/a*l;return[t+o*Math.cos(i),e+o*Math.sin(i)]})}function Ve(t,e,n){let r=n/2,a=(u,l)=>`${x(t+u*r)} ${x(e+l*r)}`;return`M${a(0,-.52)}C${a(.18,-.92)} ${a(.98,-.94)} ${a(1,-.34)}C${a(1,.12)} ${a(.5,.48)} ${a(0,.92)}C${a(-.5,.48)} ${a(-1,.12)} ${a(-1,-.34)}C${a(-.98,-.94)} ${a(-.18,-.92)} ${a(0,-.52)}Z`}function Me(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(36)}var je=24,ut=(t,e,n,r)=>{let a=r*Math.PI/180;return[t+n*Math.cos(a),e+n*Math.sin(a)]},re=([t,e])=>`${x(t)} ${x(e)}`;function Rt(t,e,n,r,a,u){let l=u-a>180?1:0;return`M${re(ut(t,e,r,a))}A${x(r)} ${x(r)} 0 ${l} 1 ${re(ut(t,e,r,u))}L${re(ut(t,e,n,u))}A${x(n)} ${x(n)} 0 ${l} 0 ${re(ut(t,e,n,a))}Z`}function qt(t,e,n,r){return`M${x(t-n)} ${x(e)}A${x(n)} ${x(r)} 0 1 1 ${x(t+n)} ${x(e)}A${x(n)} ${x(r)} 0 1 1 ${x(t-n)} ${x(e)}Z`}function Mr(t){let e=0;return t.forEach(([n,r],a)=>{let[u,l]=t[(a+1)%t.length];e+=n*l-u*r}),e/2}function We(t){return G(Mr(t)<0?[...t].reverse():t)}function oe(t,e,n,r,a){let u=Math.hypot(n-t,r-e)||1,l=-(r-e)/u*(a/2),o=(n-t)/u*(a/2);return We([[t+l,e+o],[n+l,r+o],[n-l,r-o],[t-l,e-o]])}var D=(...t)=>({d:t.join(""),fillRule:"nonzero"}),nt=(...t)=>({d:t.join(""),fillRule:"evenodd"});function Cr(){let t=[];for(let e of[0,60,120]){let[n,r]=ut(12,12,10.5,e+180),[a,u]=ut(12,12,10.5,e);t.push(oe(n,r,a,u,2))}for(let e=0;e<6;e++){let n=e*60,[r,a]=ut(12,12,6.2,n);for(let u of[-45,45]){let[l,o]=ut(r,a,3.6,n+u);t.push(oe(r,a,l,o,1.7))}}return D(...t)}var Pr={wifi:()=>D(Rt(12,20,4.6,7.2,-135,-45),Rt(12,20,9.2,11.8,-135,-45),Rt(12,20,13.8,16.4,-135,-45),$(12,20,2.2)),star:()=>D(G(ne(12,12.8,11.6,4.8))),heart:()=>D(Ve(12,12.4,22)),phone:()=>nt(R(6,1.5,12,21,2.6),R(7.8,4.2,8.4,13.4,.6),$(12,19.8,1.1)),headphones:()=>D(Rt(12,13,7.6,9.8,-180,0),R(2,12,5,9.5,2),R(17,12,5,9.5,2)),calendar:()=>nt(R(2.5,4,19,17.5,2.5),R(4.6,9,14.8,10.6,.8),R(7,11.4,2.6,2.6,.4),R(10.7,11.4,2.6,2.6,.4),R(14.4,11.4,2.6,2.6,.4),R(7,15.1,2.6,2.6,.4),R(10.7,15.1,2.6,2.6,.4),R(6.5,1.4,2.4,2.6,[1.2,1.2,0,0]),R(15.1,1.4,2.4,2.6,[1.2,1.2,0,0])),user:()=>D($(12,7.5,4.6),"M3 21.5C3 16.2 7 13.6 12 13.6C17 13.6 21 16.2 21 21.5Z"),chat:()=>nt(R(2,3,20,14,4),G([[6.5,17],[11.5,17],[5.8,21.8]]),$(7.5,10,1.5),$(12,10,1.5),$(16.5,10,1.5)),bag:()=>D(R(3.5,7.5,17,14.5,2),Rt(12,7.5,3.1,4.8,-180,0)),bell:()=>D("M3.5 17.2A8.5 8.5 0 0 1 20.5 17.2Z",R(1.5,18.2,21,2.6,1.3),R(11.2,6.6,1.6,2.6,0),R(9.8,4.6,4.4,2.4,1.2)),cup:()=>D("M4 6.5H17V13.5A6.5 6.5 0 0 1 4 13.5Z",Rt(17,10.2,1.7,3.6,-90,90),R(2,20.6,17,2,1),R(7,1.6,1.6,3.4,.8),R(11.6,1.6,1.6,3.4,.8)),card:()=>nt(R(1.5,4.5,21,15,2.5),R(1.5,8,21,3,0),R(4.5,13.6,4.6,3.2,.6)),check:()=>nt($(12,12,10.5),G([[6.6,12.4],[8.4,10.6],[10.6,12.8],[15.8,7.6],[17.6,9.4],[10.6,16.4]])),info:()=>nt($(12,12,10.5),$(12,7.2,1.6),R(10.6,10,2.8,8,.8)),home:()=>nt(G([[12,2.5],[22.5,11.5],[19.5,11.5],[19.5,21.5],[4.5,21.5],[4.5,11.5],[1.5,11.5]]),R(10,14.5,4,7,[.6,.6,0,0])),pin:()=>nt("M12 22.5C8.5 17.6 4.5 14 4.5 9.5A7.5 7.5 0 0 1 19.5 9.5C19.5 14 15.5 17.6 12 22.5Z",$(12,9.5,3)),share:()=>D(oe(6,12,18,5,1.8),oe(6,12,18,19,1.8),$(18,5,3.2),$(6,12,3.2),$(18,19,3.2)),download:()=>D(R(10.6,2,2.8,9.5,0),G([[6,10],[18,10],[12,16.5]]),G([[2.5,15],[5.3,15],[5.3,19],[18.7,19],[18.7,15],[21.5,15],[21.5,21.8],[2.5,21.8]])),clock:()=>nt($(12,12,10.5),$(12,12,8.4),G([[11,5.4],[13,5.4],[13,11.3],[16.9,13.5],[15.9,15.2],[11,12.5]])),snowflake:Cr,pumpkin:()=>D(qt(7.8,14.6,5.8,6.9),qt(16.2,14.6,5.8,6.9),qt(12,14.6,4.8,7.4),R(10.9,3.4,2.2,4.6,.8),We([[13,4.2],[17.2,3],[16.2,5.4],[13,6]])),tree:()=>D(G([[12,1.5],[16.8,8.2],[7.2,8.2]]),G([[12,5.2],[19,13.6],[5,13.6]]),G([[12,9.4],[21.2,19.2],[2.8,19.2]]),R(10.4,18.6,3.2,3.9,.4)),sparkle:()=>D(G(ne(9.5,13.5,9,2.4,4)),G(ne(19,5,4,1.1,4))),gift:()=>D(R(3,11.2,7.8,10.6,1),R(13.2,11.2,7.8,10.6,1),R(2,7.4,8.8,3.2,1),R(13.2,7.4,8.8,3.2,1),qt(8.8,4.8,2.9,1.9),qt(15.2,4.8,2.9,1.9))};function Ze(t){return Pr[t]()}var Lr={black:[0,0,0],white:[255,255,255],red:[255,0,0],green:[0,128,0],lime:[0,255,0],blue:[0,0,255],navy:[0,0,128],yellow:[255,255,0],orange:[255,165,0],purple:[128,0,128],pink:[255,192,203],gray:[128,128,128],grey:[128,128,128],silver:[192,192,192],maroon:[128,0,0],olive:[128,128,0],teal:[0,128,128],aqua:[0,255,255],cyan:[0,255,255],fuchsia:[255,0,255],magenta:[255,0,255]};function Je(t,e){let n=t.trim(),r=Number.parseFloat(n);return Number.isNaN(r)?Number.NaN:n.endsWith("%")?r/100*e:r}function zt(t){if(!t)return null;let e=t.trim().toLowerCase();if(e==="transparent")return{r:0,g:0,b:0,a:0};let n=Lr[e];if(n)return{r:n[0],g:n[1],b:n[2],a:1};if(e.startsWith("#")){let a=e.slice(1);return(a.length===3||a.length===4)&&(a=a.split("").map(u=>u+u).join("")),/^[0-9a-f]{6}([0-9a-f]{2})?$/.test(a)?{r:Number.parseInt(a.slice(0,2),16),g:Number.parseInt(a.slice(2,4),16),b:Number.parseInt(a.slice(4,6),16),a:a.length===8?Number.parseInt(a.slice(6,8),16)/255:1}:null}let r=/^rgba?\(([^)]*)\)$/.exec(e);if(r){let[a,u]=r[1].split("/"),l=a.split(/[\s,]+/).filter(Boolean);if(l.length!==(u===void 0&&l.length===4?4:3))return null;let o=u??l[3],[i,s,c]=l.slice(0,3).map(f=>Je(f,255)),m=o===void 0?1:Je(o,1);if([i,s,c,m].some(f=>Number.isNaN(f)))return null;let p=(f,d)=>Math.min(Math.max(f,0),d);return{r:p(i,255),g:p(s,255),b:p(c,255),a:p(m,1)}}return null}var Ar=["banner-top-bottom","speech-bubble-top","chat-bubble","circle","polaroid","phone","ticket","badge","envelope","tag","menu-card","sticker","gradient-border","focus"];function en(t){return Ar.includes(t)}var Ke={from:"#7c3aed",to:"#db2777"},z="#FFFFFF";function nn(t){return t===" "?.3:/[MWmw@%]/.test(t)?.92:/[A-Z0-9#&]/.test(t)?.72:/[il.,:;!'|1]/.test(t)?.32:.6}function Ft(t){let e=0;for(let n of t)e+=nn(n);return Math.max(e,1)}var Ce=t=>Math.round(Math.min(255,Math.max(0,t))).toString(16).padStart(2,"0");function V(t,e,n){let r=zt(t)??{r:0,g:0,b:0,a:1},a=zt(e)??{r:255,g:255,b:255,a:1},u=Math.min(1,Math.max(0,n));return`#${Ce(r.r+(a.r-r.r)*u)}${Ce(r.g+(a.g-r.g)*u)}${Ce(r.b+(a.b-r.b)*u)}`}var Q=(t,e,n,r,a=0)=>({x:t,y:e,width:n,height:r,radius:a}),I=(t,e,n,r,a,u)=>({type:"rect",...Q(t,e,n,r,a),fill:u}),$t=(t,e,n)=>({type:"rect",...t,fill:n,hole:e}),k=(t,e)=>({type:"polygon",points:t,fill:e}),mt=(t,e,n="nonzero")=>({type:"path",d:t,fill:e,fillRule:n}),rn=(...t)=>t.filter(e=>e!==null),Rr=t=>{let{size:e,gap:n,border:r,band:a,color:u,background:l,frame:o,fitLabel:i}=t,s=e+2*(r+n),c=s-2*r,m=e+2*n,p=a+m+a,f=c-2*n,d=o.textColor||z;return{width:s,height:p,qrX:r+n,qrY:a+n,qrSize:e,shapes:[I(r,a,c,m,0,l),$t(Q(0,0,s,p),Q(r,a,c,m),u)],label:i(t.text,s/2,a/2,a,f,d),extraLabels:rn(i(t.secondaryText,s/2,a+m+a/2,a,f,d,"secondaryText")),squareEdges:!0,color:u}},$r=t=>{let{size:e,gap:n,border:r,band:a,color:u,background:l,frame:o,fitLabel:i}=t,s=e+2*(r+n),c=s-2*r,m=e*.07,p=Math.max(m-r,0),f=e*.025,d=e*.08,h=a+d+f;return{width:s,height:h+s,qrX:r+n,qrY:h+r+n,qrSize:e,shapes:[I(0,0,s,a,a/2,u),k([[s/2-d,a-d/2],[s/2+d,a-d/2],[s/2,a+d]],u),I(r,h+r,c,c,p,l),$t(Q(0,h,s,s,m),Q(r,h+r,c,c,p),u)],label:i(t.text,s/2,a/2,a,c-2*n,o.textColor||z),squareEdges:!1,color:u}},Fr=t=>{let{size:e,gap:n,border:r,color:a,background:u,frame:l,fitLabel:o}=t,i=e+2*(r+n),s=i-2*r,c=e*.12,m=e+2*n,p=t.text?e*.2:r,f=r+m+p,d=e*.13,h=f-e*.02;return{width:i,height:f+d,qrX:r+n,qrY:r+n,qrSize:e,shapes:[I(0,0,i,f,c,a),mt(q`M${i*.13} ${h}L${i*.05} ${f+d}`+q`Q${i*.16} ${f+d*.45} ${i*.32} ${h}Z`,a),I(r,r,s,m,Math.max(c-r,0),u)],label:o(t.text,i/2,r+m+p/2,p,s-2*n,l.textColor||z),squareEdges:!1,color:a}};function ie(t,e,n,r,a,u,l,o){let i=[...t],s=a*.08,c=i.map(h=>nn(h)*a),m=c.reduce((h,b)=>h+b,0)+s*Math.max(0,i.length-1),p=u==="top"?r-a*.35:r+a*.35,f=[],d=0;return i.forEach((h,b)=>{let g=c[b],y=(d+g/2)/p;if(d+=g+s,h.trim()==="")return;let S=u==="top"?-Math.PI/2-m/2/p+y:Math.PI/2+m/2/p-y;f.push({text:h,x:e+p*Math.cos(S),y:n+p*Math.sin(S),fontSize:a,maxWidth:a*2,color:l,rotate:S*180/Math.PI+(u==="top"?90:-90),field:o})}),f}var Ir=t=>{let{size:e,gap:n,color:r,background:a,frame:u,fontScale:l}=t,o=e*Math.SQRT1_2+n*.9,i=e*.21,s=o+i,c=o+i/2,m=s,p=u.textColor||z,f=c*(140*Math.PI/180),d=y=>Math.min(i*.5*l,f/(Ft(y)+.08*y.length)),h=t.text?ie(t.text,m,m,c,d(t.text),"top",p,"text"):[],b=t.secondaryText?ie(t.secondaryText,m,m,c,d(t.secondaryText),"bottom",p,"secondaryText"):[],g=i*.07;return{width:2*s,height:2*s,qrX:m-e/2,qrY:m-e/2,qrSize:e,shapes:[mt($(m,m,o),a),mt($(m,m,s)+$(m,m,o),r,"evenodd"),mt($(m-c,m,g)+$(m+c,m,g),p)],label:null,extraLabels:[...h,...b],squareEdges:!1,color:r}},wr=t=>{let{size:e,gap:n,color:r,background:a,frame:u,fitLabel:l}=t,o=e*.07,i=e+2*n,s=e*.3,c=e*.025,m=i+2*o,p=o+i+s,f=e*.015;return{width:m+c,height:p+c,qrX:o+n,qrY:o+n,qrSize:e,shapes:[I(c,c,m,p,f,V(r,z,.72)),I(0,0,m,p,f,r),I(o,o,i,i,0,a)],label:l(t.text,m/2,o+i+s/2,s*.8,i-2*n,u.textColor||z),squareEdges:!1,color:r}},vr=t=>{let{size:e,gap:n,color:r,background:a,frame:u,fitLabel:l}=t,o=e*.05,i=e*.17,s=e*.15,c=t.text?e*.17:0,m=e+2*n,p=n+e+(t.text?n*.5+c:n),f=m+2*o,d=i+p+s,h=e*.036,b=e*.03;return{width:f,height:d,qrX:o+n,qrY:i+n,qrSize:e,shapes:[I(0,0,f,d,e*.17,r),I(o,i,m,p,e*.06,a),I(f/2-e*.11,i/2-h/2,e*.22,h,h/2,a),I(f/2-e*.15,i+p+s/2-b/2,e*.3,b,b/2,a)],label:l(t.text,f/2,i+n+e+n*.5+c/2,c,m-2*n,u.textColor||r),squareEdges:!1,color:r}},_r=t=>{let{size:e,gap:n,band:r,color:a,background:u,frame:l,fitLabel:o}=t,i=e*.05,s=e+2*n,c=s+2*i,m=Wt(i+s+i*1.2),p=m+r,f=Wt(e*.055),d=e*.04,h=q`M${d} 0H${c-d}A${d} ${d} 0 0 1 ${c} ${d}`+q`V${m-f}A${f} ${f} 0 0 0 ${c} ${m+f}`+q`V${p-d}A${d} ${d} 0 0 1 ${c-d} ${p}`+q`H${d}A${d} ${d} 0 0 1 0 ${p-d}`+q`V${m+f}A${f} ${f} 0 0 0 0 ${m-f}`+q`V${d}A${d} ${d} 0 0 1 ${d} 0Z`,b=[],g=e*.03,y=e*.022,S=e*.012;for(let E=f+y;E+g<=c-f-y/2;E+=g+y)b.push(R(E,m-S/2,g,S));return{width:c,height:p,qrX:i+n,qrY:i+n,qrSize:e,shapes:[mt(h,a),I(i,i,s,s,e*.02,u),mt(b.join(""),u)],label:o(t.text,c/2,m+r/2,r,s-2*n,l.textColor||z),squareEdges:!1,color:a}},Tr=t=>{let{size:e,gap:n,border:r,band:a,color:u,background:l,frame:o,fitLabel:i}=t,s=e*.18,c=e*.05,m=e+2*(r+n),p=e*.06,f=Math.max(p-r,0),d=m+2*s,h=m-r,b=s*.5,g=h+c,y=b+c*2,S=s*.28,E=V(u,"#000000",.28),P=V(u,"#000000",.5);return{width:d,height:g+a,qrX:s+r+n,qrY:r+n,qrSize:e,shapes:[k([[0,g],[y,g],[y,g+a],[0,g+a],[S,g+a/2]],E),k([[d,g],[d-S,g+a/2],[d,g+a],[d-y,g+a],[d-y,g]],E),k([[b,h+a],[b+c*1.6,h+a+c],[b,h+a+c]],P),k([[d-b,h+a],[d-b,h+a+c],[d-b-c*1.6,h+a+c]],P),I(s+r,r,m-2*r,m-2*r,f,l),$t(Q(s,0,m,m,p),Q(s+r,r,m-2*r,m-2*r,f),u),I(b,h,d-2*b,a,0,u)],label:i(t.text,d/2,h+a/2,a,d-2*b-2*n,o.textColor||z),squareEdges:!1,color:u}},Nr=t=>{let{size:e,gap:n,band:r,color:a,background:u,frame:l,fitLabel:o}=t,i=e*.08,s=e+2*n,c=s+2*i,m=e*.05,p=m+n+e+n*.6,f=e*.14,d=p+f+r+e*.02,h=m+e*.32,b=e*.012,g=p+f-m;return{width:c,height:d,qrX:i+n,qrY:m+n,qrSize:e,shapes:[I(0,h,c,d-h,0,V(a,z,.45)),k([[0,h],[c/2,0],[c,h]],V(a,z,.25)),I(i,m,s,g,0,u),$t(Q(i-b,m-b,s+2*b,g+b),Q(i,m,s,g),a),k([[0,p],[c/2,p+f],[c,p],[c,d],[0,d]],a)],label:o(t.text,c/2,p+f+r/2,r,s-2*n,l.textColor||z),squareEdges:!1,color:a}},Or=t=>{let{size:e,gap:n,band:r,color:a,background:u,frame:l,fitLabel:o}=t,i=e*.06,s=e+2*n,c=s+2*i,m=e*.24,p=e*.04,f=m*.48,d=e*.14,h=t.text?r:i,b=m+s+h,g=e*.04,y=q`M${d} 0H${c-d}L${c} ${d}`+q`V${b-g}A${g} ${g} 0 0 1 ${c-g} ${b}`+q`H${g}A${g} ${g} 0 0 1 0 ${b-g}V${d}Z`+$(c/2,f,p);return{width:c,height:b,qrX:i+n,qrY:m+n,qrSize:e,shapes:[mt(y,a,"evenodd"),mt($(c/2,f,p*1.7)+$(c/2,f,p),V(a,z,.35),"evenodd"),I(i,m,s,s,e*.02,u)],label:o(t.text,c/2,m+s+h/2,h,s-2*n,l.textColor||z),squareEdges:!1,color:a}},qr=t=>{let{size:e,color:n,background:r,frame:a,fitLabel:u}=t,l=e*.13,o=t.text?e*.26:l,i=t.secondaryText?e*.2:l,s=e+2*l,c=o+e+i,m=e*.03,p=e*.022,f=e*.045,d=e*.008,h=a.textColor||n,b=[I(0,0,s,c,m,r),$t(Q(0,0,s,c,m),Q(p,p,s-2*p,c-2*p,Math.max(m-p,0)),n),$t(Q(f,f,s-2*f,c-2*f),Q(f+d,f+d,s-2*(f+d),c-2*(f+d)),n)];if(t.text){let g=o-e*.075,y=e*.022;b.push(I(s*.3,g-d/2,s*.4,d,0,n),k([[s/2,g-y],[s/2+y,g],[s/2,g+y],[s/2-y,g]],n))}return{width:s,height:c,qrX:l,qrY:o,qrSize:e,shapes:b,label:u(t.text,s/2,e*.115,e*.17,s-2*l,h),extraLabels:rn(u(t.secondaryText,s/2,o+e+i*.45,i*.8,s-2*l,h,"secondaryText")),squareEdges:!1,color:n}},zr=t=>{let{size:e,gap:n,color:r,background:a,frame:u,fitLabel:l}=t,o=e*.025,i=e*.07,s=e*.03,c=e*.13,m=t.text?e*.17:0,p=n*1.25,f=e+2*p,d=f+2*i,h=f+2*i+m,b=d+2*o,g=h+2*o;return{width:b+s,height:g+s,qrX:o+i+p,qrY:o+i+p,qrSize:e,shapes:[I(s,s,b,g,c+o,V(r,z,.7)),I(0,0,b,g,c+o,z),I(o,o,d,h,c,r),I(o+i,o+i,f,f,e*.04,a)],label:l(t.text,o+d/2,o+i+f+(i+m)/2,i+m,f-2*n,u.textColor||z),squareEdges:!1,color:r}};function tn(t,e,n,r){let a=t<e+r?e+r-t:t>e+n-r?t-(e+n-r):0;return r-Math.sqrt(Math.max(0,r*r-Math.min(a,r)**2))}function Dr(t,e,n,r,a,u,l=48){let o=Math.max(n-r,0),i=t-2*r,s=new Set([r,t-r]);for(let b=0;b<=l;b++)s.add(t*b/l);let c=[...s].sort((b,g)=>b-g),m=t*.002,p=5,f=b=>tn(b,0,t,n),d=b=>r+tn(b,r,i,o),h=[];for(let b=0;b+1<c.length;b++){let g=c[b],y=Math.min(t,c[b+1]+(b+2<c.length?m:0)),S=V(a,u,(g+y)/2/t),E=M=>Array.from({length:p},(L,w)=>{let _=w/(p-1);return M?y+(g-y)*_:g+(y-g)*_});g>=r-1e-9&&c[b+1]<=t-r+1e-9?h.push(k([...E(!1).map(M=>[M,f(M)]),...E(!0).map(M=>[M,d(M)])],S),k([...E(!1).map(M=>[M,e-d(M)]),...E(!0).map(M=>[M,e-f(M)])],S)):h.push(k([...E(!1).map(M=>[M,f(M)]),...E(!0).map(M=>[M,e-f(M)])],S))}return h}var kr=t=>{let{size:e,gap:n,background:r,frame:a,fitLabel:u}=t,l=a.color||Ke.from,o=a.secondaryColor||Ke.to,i=e*.05,s=e+2*(i+n),c=t.text?e*.18:0,m=e+(t.text?n+c:2*n),p=m+2*i,f=e*.1;return{width:s,height:p,qrX:i+n,qrY:i+n,qrSize:e,shapes:[I(i,i,s-2*i,m,f-i,r),...Dr(s,p,f,i,l,o)],label:u(t.text,s/2,i+n+e+c/2,c,s-2*i-2*n,a.textColor||V(l,o,.5)),squareEdges:!1,color:l}},Br=t=>{let{size:e,gap:n,color:r,background:a,frame:u,fitLabel:l}=t,o=e*.035,i=e*.2,s=e+2*(n+o),c=t.text?e*.2:0,m=s,p=m+c,f=(d,h,b,g)=>[[d,h],[d+b*i,h],[d+b*i,h+g*o],[d+b*o,h+g*o],[d+b*o,h+g*i],[d,h+g*i]];return{width:s,height:p,qrX:o+n,qrY:o+n,qrSize:e,shapes:[I(0,0,s,p,0,a),k(f(0,0,1,1),r),k(f(m,0,-1,1),r),k(f(m,m,-1,-1),r),k(f(0,m,1,-1),r)],label:l(t.text,s/2,m+c*.4,c,s-2*n,u.textColor||r),squareEdges:!1,color:r}},on={"banner-top-bottom":Rr,"speech-bubble-top":$r,"chat-bubble":Fr,circle:Ir,polaroid:wr,phone:vr,ticket:_r,badge:Tr,envelope:Nr,tag:Or,"menu-card":qr,sticker:zr,"gradient-border":kr,focus:Br};function xt(t,e="#000000"){return t?typeof t=="string"?t:t.type==="solid"?t.color:t.type==="image"?t.underlay||e:(t.type==="linear"||t.type==="radial"||t.type==="angular")&&t.stops[0]?.color||e:e}var ae=class extends Error{issues;constructor(e){super(`Invalid frame spec: ${e.slice(0,5).join("; ")}`),this.name="FrameSpecError",this.issues=e}},an=new WeakMap;function Gr(t){if(t&&typeof t=="object"){let n=an.get(t);if(n)return n}if(t==null)throw new ae(['A "custom" frame needs a spec']);let e=Ee.safeParse(t);if(!e.success)throw new ae(e.error.issues.map(n=>n.path.length>0?`${n.path.join(".")}: ${n.message}`:n.message));return typeof t=="object"&&an.set(t,e.data),e.data}function Ur(t){let e=xt(t,tt),n=zt(e);return n&&n.a>=1?e:tt}function Yr(t,e,n){let r=t.color||e.colors.frame,a=t.textColor||e.colors.text||r,u=t.secondaryColor||e.colors.accent||r,l=o=>{switch(o){case"frame":return r;case"text":return a;case"accent":return u;case"background":return n;default:return o}};return o=>typeof o=="string"?l(o):V(l(o.mix[0]),l(o.mix[1]),o.amount)}function sn(t,e,n=0,r=0){let a=Zt(t);return a?ze(a,e,n,r):""}function Hr(t,e,n,r){return`M${x(t-n)} ${x(e)}A${x(n)} ${x(r)} 0 1 1 ${x(t+n)} ${x(e)}A${x(n)} ${x(r)} 0 1 1 ${x(t-n)} ${x(e)}Z`}function Qr(t,e){let[n,r,a,u]=[t.x1*e,t.y1*e,t.x2*e,t.y2*e],l=Math.hypot(a-n,u-r),o=t.width*e/2,i=l>0?(a-n)/l:1,s=l>0?(u-r)/l:0,c=-s*o,m=i*o,p=(b,g)=>{let y=[n+i*b,r+s*b],S=[n+i*g,r+s*g];if(t.cap==="round"&&g-b>2*o){let E=[y[0]+i*o,y[1]+s*o],P=[S[0]-i*o,S[1]-s*o];return`M${x(E[0]-c)} ${x(E[1]-m)}L${x(P[0]-c)} ${x(P[1]-m)}A${x(o)} ${x(o)} 0 0 1 ${x(P[0]+c)} ${x(P[1]+m)}L${x(E[0]+c)} ${x(E[1]+m)}A${x(o)} ${x(o)} 0 0 1 ${x(E[0]-c)} ${x(E[1]-m)}Z`}return`M${x(y[0]-c)} ${x(y[1]-m)}L${x(S[0]-c)} ${x(S[1]-m)}L${x(S[0]+c)} ${x(S[1]+m)}L${x(y[0]+c)} ${x(y[1]+m)}Z`};if(!t.dash)return{type:"path",d:p(0,l),fillRule:"nonzero"};let f=t.dash[0]*e,d=f+t.dash[1]*e,h=[];for(let b=0;b+f<=l+1e-6;b+=d)h.push(p(b,b+f));return{type:"path",d:h.join(""),fillRule:"nonzero"}}function Xr(t,e){switch(t.type){case"rect":return{type:"rect",x:t.x*e,y:t.y*e,width:t.width*e,height:t.height*e,radius:(t.radius??0)*e,...t.hole&&{hole:{x:t.hole.x*e,y:t.hole.y*e,width:t.hole.width*e,height:t.hole.height*e,radius:(t.hole.radius??0)*e}}};case"circle":return{type:"path",d:$(t.cx*e,t.cy*e,t.r*e)+(t.hole?$(t.cx*e,t.cy*e,t.hole*e):""),fillRule:t.hole?"evenodd":"nonzero"};case"ellipse":return{type:"path",d:Hr(t.cx*e,t.cy*e,t.rx*e,t.ry*e),fillRule:"nonzero"};case"polygon":return{type:"polygon",points:t.points.map(([n,r])=>[n*e,r*e])};case"path":return{type:"path",d:sn(t.d,e),fillRule:t.fillRule??"nonzero"};case"line":return Qr(t,e);default:{let n=Ze(t.icon);return{type:"path",d:sn(n.d,t.size*e/je,t.x*e,t.y*e),fillRule:n.fillRule}}}}function Vr(t){if(t.type==="rect"){let{x:e,y:n,width:r,height:a,radius:u,hole:l}=t;return[...de(e,n,r,a,u,u),...l?de(l.x,l.y,l.width,l.height,l.radius,l.radius):[]]}return t.type==="polygon"?[...t.points.map(([e,n],r)=>r===0?{op:"M",x:e,y:n}:{op:"L",x:e,y:n}),{op:"Z"}]:Jt(t.d)}function jr(t,e,n){let r=Vr(t),a=ke(r,.2),u=t.type==="rect"?t.hole?"evenodd":"nonzero":t.type==="path"?t.fillRule??"nonzero":"nonzero",l=e.direction==="vertical",o=b=>l?b[1]:b[0],i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(let b of a)for(let g of b)i=Math.min(i,o(g)),s=Math.max(s,o(g));if(!(s>i))return[];let c=e.steps??32,m=n(e.from),p=n(e.to),f=s-i,d=f*.002,h=[];for(let b=0;b<c;b++){let g=i+f*b/c,y=Math.min(s,i+f*(b+1)/c+(b+1<c?d:0)),S=l?{x0:Number.NEGATIVE_INFINITY,x1:Number.POSITIVE_INFINITY,y0:g,y1:y}:{x0:g,x1:y,y0:Number.NEGATIVE_INFINITY,y1:Number.POSITIVE_INFINITY},E=a.map(P=>Be(P,S)).filter(P=>P.length>2);E.length!==0&&h.push({type:"path",d:Ge(E),fill:V(m,p,(b+.5)/c),fillRule:u})}return h}function Wr(t,e,n){let r=Xr(t,e);return typeof t.fill=="object"&&"gradient"in t.fill?jr(r,t.fill.gradient,n):[{...r,fill:n(t.fill)}]}function Zr(t,e){let n=Math.min(t.maxLength??N.maxTextLength,N.maxTextLength),r=t.slot==="primary"?e.text??t.text:t.slot==="secondary"?e.secondaryText??t.text:t.text;return xe(r,n)}function Jr(t){return t===void 0||!Number.isFinite(t)?1:Math.min(bt,Math.max(Nt,t))}function Kr(t,e,n,r){let a=Zr(t,e);if(!a)return[];let u=Jr(e.fontScale),l=r(t.color),o=t.weight==="regular"?{fontWeight:400}:{};if(t.type==="curved"){let{cx:h,cy:b,radius:g,side:y,spread:S=140}=t.curve,E=g*n*(S*Math.PI/180),P=Math.min(t.fontSize*n*u,E/(Ft(a)+.08*a.length));return ie(a,h*n,b*n,g*n,P,y,l,t.id).map(M=>({...M,...o}))}let i=t.box.x*n,s=t.box.y*n,c=t.box.width*n,m=t.box.height*n,p=(t.fontSize??t.box.height*.52)*n,f=Math.min(p*u,m*ye,c/Ft(a)),d=t.align??"middle";return[{text:a,x:d==="start"?i:d==="end"?i+c:i+c/2,y:s+m/2+f*.35,fontSize:f,maxWidth:c,color:l,...d!=="middle"&&{align:d},...o,field:t.id}]}function cn(t,e,n){let r=Gr(e.spec),a=t/r.qr.size,u=Ur(n),l=Yr(e,r,u),o=r.shapes.flatMap(f=>Wr(f,a,l)),i=ee(r)*a;o.push({type:"rect",x:r.qr.x*a-i,y:r.qr.y*a-i,width:t+2*i,height:t+2*i,radius:(r.qr.radius??0)*a,fill:u});let s=r.labels.flatMap(f=>Kr(f,e,a,l)),c=s[0],m=c&&c.rotate===void 0?c:null,p=r.bleed??"none";return{width:r.artboard.width*a,height:r.artboard.height*a,qrX:r.qr.x*a,qrY:r.qr.y*a,qrSize:t,shapes:o,label:m,extraLabels:m?s.slice(1):s,squareEdges:p!=="none",color:l(p==="none"?"frame":p)}}import{jsx as pa,jsxs as fa}from"react/jsx-runtime";var to="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",eo=.08,no="#000000",Pe="#FFFFFF";function ln(t){return!!(t?.style&&t.style!=="none")}function ro(t){return(t.text??Oe).trim().slice(0,et)}function oo(t){return(t.secondaryText??"").trim().slice(0,et)}function io(t){return t===void 0||!Number.isFinite(t)?1:Math.min(bt,Math.max(Nt,t))}function ao(t,e,n,r,a,u,l,o){if(!t)return null;let i=Math.min(r*.52*l,a/Ft(t));return{text:t,x:e,y:n+i*.35,fontSize:i,maxWidth:a,color:u,field:o}}function un(t,e,n){if(e.style===be)return cn(t,e,n);let r=e.color||no,a=xt(n,tt),u=ro(e),l=t*eo,o=t*.04,i=t*.22,s=t+2*(o+l),c=s-2*o,m=c-2*l,p=o+l,f=io(e.fontScale),d=(h,b,g,y,S,E,P="text")=>ao(h,b,g,y,S,E,f,P);if(en(e.style))return on[e.style]({size:t,frame:e,color:r,background:a,text:u,secondaryText:oo(e),gap:l,border:o,band:i,fontScale:f,fitLabel:d});switch(e.style){case"banner-top":{let h=t+2*l;return{width:s,height:i+h+o,qrX:p,qrY:i+l,qrSize:t,shapes:[Dt(o,i,c,h,0,a),se(rt(0,0,s,i+h+o,0),rt(o,i,c,h,0),r)],label:d(u,s/2,i/2,i,m,e.textColor||Pe),squareEdges:!0,color:r}}case"border":case"rounded-border":{let h=u?t*.18:0,b=t+(u?l+h:2*l),g=b+2*o,y=e.style==="rounded-border"?t*.1:0,S=Math.max(y-o,0);return{width:s,height:g,qrX:p,qrY:o+l,qrSize:t,shapes:[Dt(o,o,c,b,S,a),se(rt(0,0,s,g,y),rt(o,o,c,b,S),r)],label:d(u,s/2,o+l+t+h/2,h,m,e.textColor||r),squareEdges:y===0,color:r}}case"speech-bubble":{let h=t*.07,b=Math.max(h-o,0),g=t*.025,y=t*.08,S=s+g+y;return{width:s,height:S+i,qrX:p,qrY:o+l,qrSize:t,shapes:[Dt(o,o,c,c,b,a),se(rt(0,0,s,s,h),rt(o,o,c,c,b),r),{type:"polygon",points:[[s/2-y,S+y/2],[s/2,s+g],[s/2+y,S+y/2]],fill:r},Dt(0,S,s,i,i/2,r)],label:d(u,s/2,S+i/2,i,m,e.textColor||Pe),squareEdges:!1,color:r}}default:{let h=t+2*l;return{width:s,height:o+h+i,qrX:p,qrY:o+l,qrSize:t,shapes:[Dt(o,o,c,h,0,a),se(rt(0,0,s,o+h+i,0),rt(o,o,c,h,0),r)],label:d(u,s/2,o+h+i/2,i,m,e.textColor||Pe),squareEdges:!0,color:r}}}}function rt(t,e,n,r,a){return{x:t,y:e,width:n,height:r,radius:a}}function Dt(t,e,n,r,a,u){return{type:"rect",...rt(t,e,n,r,a),fill:u}}function se(t,e,n){return{type:"rect",...t,fill:n,hole:e}}function so(t){return[...t.label?[t.label]:[],...t.extraLabels??[]]}function mn(t,e){let n=({x:r,y:a,width:u,height:l,radius:o})=>{let i=Math.min(o,u/2,l/2);t.moveTo(r+i,a),t.arcTo(r+u,a,r+u,a+l,i),t.arcTo(r+u,a+l,r,a+l,i),t.arcTo(r,a+l,r,a,i),t.arcTo(r,a,r+u,a,i),t.closePath()};for(let r of e.shapes)if(!(r.fill==="transparent"||r.fill==="none")){if(t.fillStyle=r.fill,r.type==="path"){typeof Path2D<"u"&&t.fill(new Path2D(r.d),r.fillRule??"nonzero");continue}t.beginPath(),r.type==="polygon"?(r.points.forEach(([a,u],l)=>{l===0?t.moveTo(a,u):t.lineTo(a,u)}),t.closePath(),t.fill()):(n(r),r.hole&&n(r.hole),t.fill("evenodd"))}for(let r of so(e))t.fillStyle=r.color,t.font=`${r.fontWeight??700} ${r.fontSize}px ${to}`,t.textAlign=r.align==="start"?"left":r.align==="end"?"right":"center",t.textBaseline="alphabetic",r.rotate?(t.save(),t.translate(r.x,r.y),t.rotate(r.rotate*Math.PI/180),t.fillText(r.text,0,0,r.maxWidth),t.restore()):t.fillText(r.text,r.x,r.y,r.maxWidth)}import{jsx as ga,jsxs as ba}from"react/jsx-runtime";var co=.22,lo=.14;function uo(t,e){let n=t.w*e,r=t.h*e;return{x:t.x+n,y:t.y+r,w:t.w-2*n,h:t.h-2*r}}function Le(t,e,n){if(t.beginPath(),e==="circle"){t.arc(n.x+n.w/2,n.y+n.h/2,Math.min(n.w,n.h)/2,0,Math.PI*2);return}let r=e==="rounded"?Math.min(n.w,n.h)*co:0;r>0&&typeof t.roundRect=="function"?t.roundRect(n.x,n.y,n.w,n.h,r):t.rect(n.x,n.y,n.w,n.h)}function pn(t,e){return e?uo(t,lo):t}var{QrCode:Ae}=H,mo={"1L":3,"1M":2,"1Q":1,"1H":1,"2L":2,"3L":1};function po(t){let e=t*4+17,n=new Uint8Array(e*e),r=(l,o)=>{l>=0&&o>=0&&l<e&&o<e&&(n[o*e+l]=1)};for(let l=0;l<e;l++)r(6,l),r(l,6);for(let[l,o]of[[3,3],[e-4,3],[3,e-4]])for(let i=-4;i<=4;i++)for(let s=-4;s<=4;s++)r(l+s,o+i);let a=[];if(t>1){let l=Math.floor(t/7)+2,o=t===32?26:Math.ceil((t*4+4)/(l*2-2))*2;a.push(6);for(let i=e-7;a.length<l;i-=o)a.splice(1,0,i)}let u=a.length-1;for(let[l,o]of a.entries())for(let[i,s]of a.entries())if(!(l===0&&i===0||l===0&&i===u||l===u&&i===0))for(let c=-2;c<=2;c++)for(let m=-2;m<=2;m++)r(o+m,s+c);for(let l=0;l<=8;l++)r(8,l),r(l,8);for(let l=0;l<8;l++)r(e-1-l,8),r(8,e-1-l);if(t>=7)for(let l=0;l<18;l++){let o=e-11+l%3,i=Math.floor(l/3);r(o,i),r(i,o)}return n}function fo(t,e){let n=t*4+17,r=ct[e].ordinal,a=Ae.NUM_ERROR_CORRECTION_BLOCKS[r]?.[t]??0,u=Ae.ECC_CODEWORDS_PER_BLOCK[r]?.[t]??0,l=Math.floor(Ae.getNumRawDataModules(t)/8),o=a-l%a,i=Math.floor(l/a),s=Array.from({length:a},(E,P)=>i+(P<o?0:1)),c=[],m=[],p=i-u;for(let E=0;E<=i;E++)for(let P=0;P<a;P++)if(P<o){if(E===p)continue;c.push(P),m.push(E<p?E:E-1)}else c.push(P),m.push(E);if(c.length!==l)throw new Error(`Codeword map: interleave mismatch at version ${t}`);let f=po(t),d=new Int16Array(n*n).fill(-1),h=new Int16Array(n*n).fill(-1),b=new Int8Array(n*n).fill(-1),g=l*8,y=0;for(let E=n-1;E>=1;E-=2){E===6&&(E=5);let P=(E+1&2)===0;for(let M=0;M<n;M++)for(let L=0;L<2;L++){let w=E-L,O=(P?n-1-M:M)*n+w;if(!f[O]&&y<g){let K=y>>>3;d[O]=c[K],h[O]=m[K],b[O]=7-(y&7),y++}}}if(y!==g)throw new Error(`Codeword map: placement mismatch at version ${t}`);let S=mo[`${t}${e}`]??0;return{version:t,level:e,size:n,blocks:a,eccPerBlock:u,blockLengths:s,correctable:Math.floor((u-S)/2),block:d,codeword:h,bit:b}}var ho=8,St=new Map;function fn(t,e){if(!(Number.isInteger(t)&&t>=1&&t<=40))throw new RangeError(`QR version must be 1\u201340, got ${t}`);let n=`${t}${e}`,r=St.get(n);if(r)return St.delete(n),St.set(n,r),r;let a=fo(t,e);if(St.size>=ho){let u=St.keys().next().value;u!==void 0&&St.delete(u)}return St.set(n,a),a}function dn(t,e){let n=new Array(t.blocks).fill(0),r=new Set;for(let a of e){let u=t.block[a]??-1;if(u<0)continue;let l=u*4096+t.codeword[a];r.has(l)||(r.add(l),n[u]=n[u]+1)}return n}import{z as A}from"zod";import{z as ot}from"zod";var go=["logo","halftone"],bo=ot.enum(go),hn={logo:["blend","badge"],halftone:["color","mono"]},yo=ot.enum([...hn.logo,...hn.halftone]),ce=192,gn=t=>Math.ceil(t/3)*4,xo=ot.object({width:ot.number().int().min(1).max(ce),height:ot.number().int().min(1).max(ce),data:ot.string().max(gn(ce*ce*4))}).refine(t=>t.data.length===gn(t.width*t.height*4),{message:"Art image data does not match its width and height"}),bn=ot.object({mode:bo,image:xo,intensity:ot.number().min(0).max(1).optional(),variant:yo.optional(),matchEyes:ot.boolean().optional()});import{z as F}from"zod";var La=F.enum(["solid","linear","radial","angular","image"]),So=F.object({type:F.literal("solid"),color:F.string()}),Re=F.object({color:F.string(),offset:F.number().min(0).max(100)}),Eo=F.object({type:F.literal("linear"),stops:F.array(Re).min(2),angle:F.number().optional().default(0)}),Mo=F.object({type:F.literal("radial"),stops:F.array(Re).min(2)}),Co=F.object({type:F.literal("angular"),stops:F.array(Re).min(2),angle:F.number().optional().default(0)}),Po=F.enum(["cover","contain","tile"]),Lo=F.enum(["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"]),Ao=F.object({type:F.literal("image"),src:F.string().min(1),fit:Po.optional().default("cover"),scale:F.number().min(.1).max(4).optional().default(1),position:Lo.optional().default("center"),opacity:F.number().min(0).max(1).optional().default(1),underlay:F.string().optional()}),Et=F.union([F.string(),So,Eo,Mo,Co,Ao]);import{z as yn}from"zod";var xn=["square","rounded","circle","message","message-reverse","diya","diya-reverse","rounded-triangle","leaf","drop","plus","cross-rounded","hexagon","octagon","flower","heart","squircle","dots","extra-rounded","leaf-reverse","drop-reverse"],Ro=["diamond","star","banner"],Sn=yn.enum([...xn,...Ro]),$a=yn.enum(xn);import{z as En}from"zod";var Mn=["square","rounded","gear","circle","diya","extra-rounded","message","pointy","leaf","drop","octagon","bevel","squircle","cushion","shield","petal","leaf-reverse"],$o=["curly"],Cn=En.enum([...Mn,...$o]),wa=En.enum(Mn);import{z as Fo}from"zod";var Io=["circle","circle-large","square","diamond","circle-mixed","pacman","rounded","small-square","vertical-line","horizontal-line","liquid","liquid-horizontal","liquid-vertical","classy","classy-rounded","leaf","plus","hexagon","star","heart","random-dots","mosaic","octagon"],Pn=Fo.enum(Io);var wo=["square","rounded","circle"],Ln=A.enum(wo),vo=A.object({src:A.string(),height:A.number(),width:A.number(),excavate:A.boolean(),x:A.number().optional(),y:A.number().optional(),padding:A.number().min(0).optional(),shape:Ln.optional(),plate:A.string().optional()}),_o=.1,To=.3;var No=2,Ga=A.object({size:A.number().min(_o).max(To).optional(),padding:A.number().min(0).max(No).optional(),x:A.number().min(0).max(1).optional(),y:A.number().min(0).max(1).optional(),shape:Ln.optional(),plate:A.string().optional()}),Oo=A.enum(["L","M","Q","H"]),qo=.5,zo=1,An=.07,Do=["square","circle","heart"],ko=A.enum(Do),Rn=3,Mt=64,kt=8,$n=.42,Bo=A.object({type:A.literal("silhouette"),width:A.number().int().min(kt).max(Mt),height:A.number().int().min(kt).max(Mt),cells:A.string().max(Mt*Mt).regex(/^[01]*$/).describe('Row by row, "1" inside the shape and "0" outside: width \xD7 height characters')}).refine(t=>t.cells.length===t.width*t.height,{message:"Silhouette cells do not match its width and height"}),Go=A.union([ko,Bo]);var $e=A.object({outer:Et.optional(),inner:Et.optional()}),Uo=A.object({topLeft:$e.optional(),topRight:$e.optional(),bottomLeft:$e.optional()}),Ua=A.object({value:A.string(),size:A.number().optional(),level:Oo.optional(),bgColor:Et.optional(),fgColor:Et.optional(),eyeColor:Et.optional(),dotColor:Et.optional(),bodyPattern:Pn.optional(),cornerEyePattern:Cn.optional(),cornerEyeDotPattern:Sn.optional(),margin:A.number().optional(),imageSettings:vo.optional(),isOGContext:A.boolean().optional(),templateId:A.string().optional(),customProps:A.record(A.string(),A.any()).optional(),frame:Xe.optional(),art:bn.optional(),eyeColors:Uo.optional(),moduleScale:A.number().min(qo).max(zo).optional(),autoLevel:A.boolean().optional(),shape:Go.optional()});var Yo={2:6,3:12};function Fn(t){let e=[t.start],n=t.start;for(let r of t.segments){let a=r.at(-1);if(r.length===1)e.push(a);else{let u=Yo[r.length];for(let l=1;l<=u;l++){let o=l/u,i=1-o;if(r.length===2){let[s]=r;e.push([i*i*n[0]+2*i*o*s[0]+o*o*a[0],i*i*n[1]+2*i*o*s[1]+o*o*a[1]])}else{let[s,c]=r;e.push([i*i*i*n[0]+3*i*i*o*s[0]+3*i*o*o*c[0]+o*o*o*a[0],i*i*i*n[1]+3*i*i*o*s[1]+3*i*o*o*c[1]+o*o*o*a[1]])}}}n=a}return e}function wn(t,e){let n=[];for(let r of t)for(let a=0;a<r.length;a++){let[u,l]=r[a],[o,i]=r[(a+1)%r.length];l<=e!=i<=e&&n.push(u+(e-l)/(i-l)*(o-u))}return n.sort((r,a)=>r-a)}function vn(t,e){let n=0;for(let r of t)if(r<e)n++;else break;return n%2===1}function Ho(t,e,n){return vn(wn(t,n),e)}function _n(t){let e=new Map;return(n,r)=>{let a=e.get(r);return a||(a=wn(t,r),e.set(r,a)),vn(a,n)}}function Qo(t,e,n,r){let a=n[0]-t,u=n[1]-e,l=r[0]-n[0],o=r[1]-n[1],i=c=>Math.max(Math.abs(a+c*l),Math.abs(u+c*o)),s=Math.min(i(0),i(1));for(let[c,m]of[[u-a,l-o],[-(a+u),l+o]])if(m!==0){let p=c/m;p>0&&p<1&&(s=Math.min(s,i(p)))}return s}function Xo(t,e,n){if(!Ho(t,e,n))return 0;let r=Number.POSITIVE_INFINITY;for(let a of t)for(let u=0;u<a.length;u++)r=Math.min(r,Qo(e,n,a[u],a[(u+1)%a.length]));return Number.isFinite(r)?r:0}function Vo(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY;for(let u of t)for(let[l,o]of u)e=Math.min(e,l),n=Math.min(n,o),r=Math.max(r,l),a=Math.max(a,o);return{x0:e,y0:n,x1:r,y1:a}}function Tn(t){let e=t.map(Fn),n=Vo(e),r=n.x1-n.x0,a=n.y1-n.y0;if(!(r>0&&a>0))return null;let u=(d,h)=>{let b=Math.max(d-n.x0,n.x1-d,h-n.y0,n.y1-h);return b>0?Xo(e,d,h)/(2*b):0},l={cx:n.x0+r/2,cy:n.y0+a/2,value:0};l.value=u(l.cx,l.cy);let o=32;for(let d=1;d<o;d++)for(let h=1;h<o;h++){let b=n.x0+r*h/o,g=n.y0+a*d/o,y=u(b,g);y>l.value&&(l={cx:b,cy:g,value:y})}let i=r/o,s=a/o;for(let d=0;d<6;d++){let h=l;for(let b=-2;b<=2;b++)for(let g=-2;g<=2;g++){let y=h.cx+i*g/2,S=h.cy+s*b/2,E=u(y,S);E>l.value&&(l={cx:y,cy:S,value:E})}i/=2,s/=2}if(l.value<=0)return null;let m=.5/Math.max(l.cx-n.x0,n.x1-l.cx,l.cy-n.y0,n.y1-l.cy),p=([d,h])=>[.5+(d-l.cx)*m,.5+(h-l.cy)*m],f=t.map(d=>({start:p(d.start),segments:d.segments.map(h=>h.map(p))}));return{rings:f,polygons:f.map(Fn),half:l.value}}function Nn(t,e){let n=([a,u])=>`${x(a*e)} ${x(u*e)}`,r="";for(let a of t.rings){r+=`M${n(a.start)}`;for(let u of a.segments){let l=u.length===1?"L":u.length===2?"Q":"C";r+=l+u.map(n).join(" ")}r+="Z"}return r}var jo={start:[0,-.58],segments:[[[.2,-.92],[1,-.97],[1,-.3]],[[1,.3],[.62,.6],[0,.92]],[[-.62,.6],[-1,.3],[-1,-.3]],[[-1,-.97],[-.2,-.92],[0,-.58]]]},In;function On(){return In??=Tn([jo]),In}function Wo(t){let{width:e,height:n,cells:r}=t;return Number.isInteger(e)&&Number.isInteger(n)&&e>=kt&&n>=kt&&e<=Mt&&n<=Mt&&typeof r=="string"&&r.length===e*n&&/^[01]*$/.test(r)?(a,u)=>a>=0&&u>=0&&a<e&&u<n&&r[u*e+a]==="1":null}var it=([t,e])=>`${t},${e}`;function Zo(t,e,n){let r=(i,s)=>t(i-1,s-1),a=new Map,u=(i,s)=>{for(let[c,m]of[[i,s],[s,i]]){let p=a.get(it(c))??[];p.push(m),a.set(it(c),p)}};for(let i=0;i<=n;i++)for(let s=0;s<=e;s++){let c=r(s,i),m=r(s+1,i),p=r(s+1,i+1),f=r(s,i+1),d=[s,i-.5],h=[s+.5,i],b=[s,i+.5],g=[s-.5,i];switch((c?8:0)+(m?4:0)+(p?2:0)+(f?1:0)){case 1:case 14:u(g,b);break;case 2:case 13:u(b,h);break;case 3:case 12:u(g,h);break;case 4:case 11:u(d,h);break;case 6:case 9:u(d,b);break;case 7:case 8:u(g,d);break;case 5:u(d,h),u(g,b);break;case 10:u(g,d),u(b,h);break;default:break}}let l=[],o=new Set;for(let[i,s]of a){if(o.has(i)||s.length===0)continue;let[c,m]=i.split(",").map(Number),p=[[c,m]];o.add(i);let f=[c,m],d=s[0];for(;!o.has(it(d));){o.add(it(d)),p.push(d);let h=Jo(a.get(it(d))??[],f,o);if(!h)break;f=d,d=h}p.length>=3&&l.push(Ko(p))}return l}function Jo(t,e,n){let r=it(e);return t.find(a=>it(a)!==r&&!n.has(it(a)))??t.find(a=>it(a)!==r)}function Ko(t){let e=[];for(let n=0;n<t.length;n++){let r=t[(n-1+t.length)%t.length],a=t[n],u=t[(n+1)%t.length],l=(a[0]-r[0])*(u[1]-a[1])-(a[1]-r[1])*(u[0]-a[0]);Math.abs(l)>1e-9&&e.push(a)}return e.length>=3?e:t}function ti(t){let e=(u,l)=>[(u[0]+l[0])/2,(u[1]+l[1])/2],n=t.length,r=e(t[n-1],t[0]),a=t.map((u,l)=>[u,e(u,t[(l+1)%n])]);return{start:r,segments:a}}var Bt=new Map;function qn(t){let e=`${t.width}x${t.height}:${t.cells}`,n=Bt.get(e);if(n)return n;let r=Wo(t),a;if(!r)a={outline:null,problem:"invalid"};else if(t.cells.includes("1")){let u=Zo(r,t.width,t.height),l=u.length>0?Tn(u.map(ti)):null;a=l&&2*l.half>=$n?{outline:l,problem:null}:{outline:null,problem:l?"thin":"empty"}}else a={outline:null,problem:"empty"};return Bt.size>16&&Bt.delete(Bt.keys().next().value),Bt.set(e,a),a}var ei=1,zn=.5,Dn=.5,ni=.5;function le(t){return Math.max(t,Rn)}function Fe(t){return t==="heart"?On():typeof t=="object"&&t?.type==="silhouette"?qn(t).outline:null}function pt(t,e,n){if(n==="circle"){let l=le(e),o=(t/2+l)*Math.SQRT2+ei;return Math.ceil(o-t/2)}let r=Fe(n);if(!r)return e;let a=le(e),u=(t+2*(a+ni))/(2*r.half);return Math.ceil((u-t)/2-1e-9)}function kn(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function ri(t,e,n){let r=pt(e,n,"circle"),a=le(n),u=e+2*r,l=u/2,o=l-zn-.5,i=kn(Number.parseInt(Me(t),36)||1),s=r-a,c=r+e+a;return Array.from({length:u},(m,p)=>Array.from({length:u},(f,d)=>{let h=i()<Dn;return d>=s&&d<c&&p>=s&&p<c?!1:h&&Math.hypot(d+.5-l,p+.5-l)<=o}))}var oi=Array.from({length:8},(t,e)=>{let n=e*Math.PI/4;return[Math.cos(n),Math.sin(n)]});function Ie(t,e,n,r){if(r==="circle")return ri(t,e,n);let a=Fe(r);if(!a)return null;let u=pt(e,n,r),l=le(n),o=e+2*u,i=_n(a.polygons),s=.5+zn,c=(d,h)=>{let b=d+.5,g=h+.5;return i(b/o,g/o)?oi.every(([y,S])=>i((b+y*s)/o,(g+S*s)/o)):!1},m=kn(Number.parseInt(Me(t),36)||1),p=u-l,f=u+e+l;return Array.from({length:o},(d,h)=>Array.from({length:o},(b,g)=>{let y=m()<Dn;return g>=p&&g<f&&h>=p&&h<f?!1:y&&c(g,h)}))}function we(t,e){if(t==="circle")return{circle:e/2};let n=Fe(t);return n?{path:Nn(n,e)}:null}import ts from"react";import{Fragment as ls,jsx as ss,jsxs as cs}from"react/jsx-runtime";function Bn(t,e){return t.slice().map((n,r)=>r<e.y||r>=e.y+e.h?n:n.map((a,u)=>u<e.x||u>=e.x+e.w?a:!1))}function ve(t,e=0){let n=[];return t.forEach((r,a)=>{let u=null;r.forEach((l,o)=>{if(!l&&u!==null){n.push(q`M${u+e} ${a+e}h${o-u}v1H${u+e}z`),u=null;return}if(o===r.length-1){if(!l)return;u===null?n.push(q`M${o+e},${a+e} h1v1H${o+e}z`):n.push(q`M${u+e},${a+e} h${o+1-u}v1H${u+e}z`);return}l&&u===null&&(u=o)})}),n.join("")}function Gt(t,e,n,r){if(r==null)return null;let a=t.length,u=Math.floor(e*jt),l=(a+2*n)/e,o=(r.width||u)*l,i=(r.height||u)*l,s=r.x==null?a/2-o/2:r.x*l,c=r.y==null?a/2-i/2:r.y*l,m=null;if(r.excavate){let p=Math.max(0,r.padding??0)*l,f=Math.floor(s-p),d=Math.floor(c-p),h=Math.ceil(o+s+p-f),b=Math.ceil(i+c+p-d);m={x:f,y:d,w:h,h:b}}return{x:s,y:c,h:i,w:o,excavation:m}}function ue(t){let e=t.level??At,{imageSettings:n}=t,r=t.isOGContext&&n?.excavate&&(e==="L"||e==="M")?"Q":e;if(t.autoLevel&&n&&r!=="H"){let a=H.QrCode.encodeText(t.value,ct[r]).getModules(),u=Gt(a,t.size??Qt,pt(a.length,t.margin??Vt,t.shape),n);u&&(u.excavation?u.excavation.w*u.excavation.h:u.w*u.h)/(a.length*a.length)>An&&(r="H")}return r}var _e=(()=>{try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})();var ii=.6,ai=["L","M","Q","H"];function si(t){let e=H.QrCode.encodeText(t.value,ct[t.level]),n=ai[e.errorCorrectionLevel.ordinal]??t.level;return{code:t,cells:e.getModules(),layoutMargin:pt(e.size,t.margin,t.shape),map:fn(e.version,n),level:n,version:e.version}}function ci(t,e){let{cells:n,map:r}=t,a=n.length,u=Gt(n,t.code.size,t.layoutMargin,e);if(!u)return null;let l=u.excavation??{x:Math.floor(u.x),y:Math.floor(u.y),w:Math.ceil(u.x+u.w)-Math.floor(u.x),h:Math.ceil(u.y+u.h)-Math.floor(u.y)},o=[];for(let s=Math.max(0,l.y);s<Math.min(a,l.y+l.h);s++)for(let c=Math.max(0,l.x);c<Math.min(a,l.x+l.w);c++)o.push(s*a+c);let i=dn(r,o);return{worst:Math.max(0,...i),correctable:r.correctable,budget:Math.floor(r.correctable*ii),level:t.level,version:t.version}}var li=t=>!t||t.worst<=t.budget;function ui(t,e,n,r){let a=e.map(o=>si({...t,level:o})),u=o=>{let i=r(o);return a.every(s=>li(ci(s,i)))};if(u(n))return n;let l=t.size*.005;for(let o=n-l;o>0;o-=l)if(u(o))return o;return 0}function Gn(t,e){if(!e)return;let n=Math.floor(t.size*jt),r=e.width||n,a=e.height||n,u=p=>{if(p===r)return e;let f=a*p/r;return{...e,width:p,height:f,...e.x!=null&&{x:e.x+(r-p)/2},...e.y!=null&&{y:e.y+(a-f)/2}}},l=t.level??At,o={value:t.value,size:t.size,margin:t.margin,shape:t.shape},i=p=>ue({...t,level:l,imageSettings:p}),s=p=>{let f=ui(o,[p],r,u);return f>0?u(f):void 0},c=i(e);if(c===l)return s(l);let m=s(c);return m&&i(m)===c?m:s(l)}import{Fragment as fi,jsx as Yn,jsxs as di}from"react/jsx-runtime";function As(t){let{value:e,size:n=Qt,level:r=At,bgColor:a=tt,fgColor:u=Xt,margin:l=Vt,style:o,imageSettings:i,eyeColor:s,dotColor:c,bodyPattern:m,cornerEyePattern:p,cornerEyeDotPattern:f,isOGContext:d,templateId:h,customTemplate:b,customProps:g,frame:y,art:S,eyeColors:E,moduleScale:P,frameLabelMarkers:M,autoLevel:L,shape:w,..._}=t,O=Gn({value:e,size:n,margin:l,level:r,shape:w,autoLevel:L},i),K=ue({value:e,size:n,level:r,margin:l,imageSettings:O,autoLevel:L,shape:w}),X=O?.src,U=ln(y)?un(n,y,a):null,Z=U?.width??n,at=U?.height??n,ft=Un(null),It=Un(null),[j,Y]=pi(!1);mi(()=>{if(ft.current!=null){let wt=ft.current,v=wt.getContext("2d");if(!v)return;let J=H.QrCode.encodeText(e,ct[K]).getModules(),st=pt(J.length,l,w),vt=Ie(e,J.length,l,w),Ct=J.length+st*2,ht=Gt(J,n,st,O),Ut=It.current,Te=ht!=null&&Ut?.complete&&Ut.naturalHeight!==0&&Ut.naturalWidth!==0;Te&&ht.excavation!=null&&(J=Bn(J,ht.excavation));let Yt=window.devicePixelRatio||1;wt.width=Z*Yt,wt.height=at*Yt,v.scale(Yt,Yt),U&&(mn(v,U),v.translate(U.qrX,U.qrY));let Ne=n/Ct;v.scale(Ne,Ne),v.fillStyle=xt(a,tt);let _t=we(w,Ct);if(_t&&"circle"in _t?(v.beginPath(),v.arc(Ct/2,Ct/2,_t.circle,0,2*Math.PI),v.fill()):_t&&_e?v.fill(new Path2D(_t.path),"evenodd"):v.fillRect(0,0,Ct,Ct),v.fillStyle=xt(u,Xt),_e)v.fill(new Path2D(ve(J,st))),vt&&v.fill(new Path2D(ve(vt,0)));else for(let[Ht,Pt]of[[J,st],[vt??[],0]])Ht.forEach((Tt,gt)=>{Tt.forEach((Hn,Qn)=>{Hn&&v.fillRect(Qn+Pt,gt+Pt,1,1)})});if(Te){let Ht={x:ht.x+st,y:ht.y+st,w:ht.w,h:ht.h},Pt=O?.shape??"square",Tt=O?.plate,gt=pn(Ht,Tt);v.save(),Tt&&(Le(v,Pt,Ht),v.fillStyle=Tt,v.fill()),Pt!=="square"&&(Le(v,Pt,gt),v.clip()),v.drawImage(Ut,gt.x,gt.y,gt.w,gt.h),v.restore()}}});let W={height:at,width:Z,...o},dt=null;return X!=null&&(dt=Yn("img",{alt:"QR code",onLoad:()=>{Y(!0)},ref:It,src:X,style:{display:"none"}},X)),di(fi,{children:[Yn("canvas",{height:at,ref:ft,style:W,width:Z,..._}),dt]})}export{As as QRCodeCanvas};
|
|
1
|
+
"use client";import{useEffect as di,useRef as Hn,useState as hi}from"react";var Lt;(u=>{class t{constructor(o,i,s,c){this.version=o;this.errorCorrectionLevel=i;if(o<t.MIN_VERSION||o>t.MAX_VERSION)throw new RangeError("Version value out of range");if(c<-1||c>7)throw new RangeError("Mask value out of range");this.size=o*4+17;let m=[];for(let f=0;f<this.size;f++)m.push(!1);for(let f=0;f<this.size;f++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();let p=this.addEccAndInterleave(s);if(this.drawCodewords(p),c==-1){let f=1e9;for(let d=0;d<8;d++){this.applyMask(d),this.drawFormatBits(d);let h=this.getPenaltyScore();h<f&&(c=d,f=h),this.applyMask(d)}}r(0<=c&&c<=7),this.mask=c,this.applyMask(c),this.drawFormatBits(c),this.isFunction=[]}version;errorCorrectionLevel;static encodeText(o,i){let s=u.QrSegment.makeSegments(o);return t.encodeSegments(s,i)}static encodeBinary(o,i){let s=u.QrSegment.makeBytes(o);return t.encodeSegments([s],i)}static encodeSegments(o,i,s=1,c=40,m=-1,p=!0){if(!(t.MIN_VERSION<=s&&s<=c&&c<=t.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let f,d;for(f=s;;f++){let y=t.getNumDataCodewords(f,i)*8,S=a.getTotalBits(o,f);if(S<=y){d=S;break}if(f>=c)throw new RangeError("Data too long")}for(let y of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])p&&d<=t.getNumDataCodewords(f,y)*8&&(i=y);let h=[];for(let y of o){e(y.mode.modeBits,4,h),e(y.numChars,y.mode.numCharCountBits(f),h);for(let S of y.getData())h.push(S)}r(h.length==d);let b=t.getNumDataCodewords(f,i)*8;r(h.length<=b),e(0,Math.min(4,b-h.length),h),e(0,(8-h.length%8)%8,h),r(h.length%8==0);for(let y=236;h.length<b;y^=253)e(y,8,h);let g=[];for(;g.length*8<h.length;)g.push(0);return h.forEach((y,S)=>g[S>>>3]|=y<<7-(S&7)),new t(f,i,g,m)}size;mask;modules=[];isFunction=[];getModule(o,i){return 0<=o&&o<this.size&&0<=i&&i<this.size&&this.modules[i][o]}getModules(){return this.modules}drawFunctionPatterns(){for(let s=0;s<this.size;s++)this.setFunctionModule(6,s,s%2==0),this.setFunctionModule(s,6,s%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let o=this.getAlignmentPatternPositions(),i=o.length;for(let s=0;s<i;s++)for(let c=0;c<i;c++)s==0&&c==0||s==0&&c==i-1||s==i-1&&c==0||this.drawAlignmentPattern(o[s],o[c]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(o){let i=this.errorCorrectionLevel.formatBits<<3|o,s=i;for(let m=0;m<10;m++)s=s<<1^(s>>>9)*1335;let c=(i<<10|s)^21522;r(c>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,n(c,m));this.setFunctionModule(8,7,n(c,6)),this.setFunctionModule(8,8,n(c,7)),this.setFunctionModule(7,8,n(c,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,n(c,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,n(c,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,n(c,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let o=this.version;for(let s=0;s<12;s++)o=o<<1^(o>>>11)*7973;let i=this.version<<12|o;r(i>>>18==0);for(let s=0;s<18;s++){let c=n(i,s),m=this.size-11+s%3,p=Math.floor(s/3);this.setFunctionModule(m,p,c),this.setFunctionModule(p,m,c)}}drawFinderPattern(o,i){for(let s=-4;s<=4;s++)for(let c=-4;c<=4;c++){let m=Math.max(Math.abs(c),Math.abs(s)),p=o+c,f=i+s;0<=p&&p<this.size&&0<=f&&f<this.size&&this.setFunctionModule(p,f,m!=2&&m!=4)}}drawAlignmentPattern(o,i){for(let s=-2;s<=2;s++)for(let c=-2;c<=2;c++)this.setFunctionModule(o+c,i+s,Math.max(Math.abs(c),Math.abs(s))!=1)}setFunctionModule(o,i,s){this.modules[i][o]=s,this.isFunction[i][o]=!0}addEccAndInterleave(o){let i=this.version,s=this.errorCorrectionLevel;if(o.length!=t.getNumDataCodewords(i,s))throw new RangeError("Invalid argument");let c=t.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][i],m=t.ECC_CODEWORDS_PER_BLOCK[s.ordinal][i],p=Math.floor(t.getNumRawDataModules(i)/8),f=c-p%c,d=Math.floor(p/c),h=[],b=t.reedSolomonComputeDivisor(m);for(let y=0,S=0;y<c;y++){let E=o.slice(S,S+d-m+(y<f?0:1));S+=E.length;let R=t.reedSolomonComputeRemainder(E,b);y<f&&E.push(0),h.push(E.concat(R))}let g=[];for(let y=0;y<h[0].length;y++)h.forEach((S,E)=>{(y!=d-m||E>=f)&&g.push(S[y])});return r(g.length==p),g}drawCodewords(o){if(o.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let i=0;for(let s=this.size-1;s>=1;s-=2){s==6&&(s=5);for(let c=0;c<this.size;c++)for(let m=0;m<2;m++){let p=s-m,d=(s+1&2)==0?this.size-1-c:c;!this.isFunction[d][p]&&i<o.length*8&&(this.modules[d][p]=n(o[i>>>3],7-(i&7)),i++)}}r(i==o.length*8)}applyMask(o){if(o<0||o>7)throw new RangeError("Mask value out of range");for(let i=0;i<this.size;i++)for(let s=0;s<this.size;s++){let c;switch(o){case 0:c=(s+i)%2==0;break;case 1:c=i%2==0;break;case 2:c=s%3==0;break;case 3:c=(s+i)%3==0;break;case 4:c=(Math.floor(s/3)+Math.floor(i/2))%2==0;break;case 5:c=s*i%2+s*i%3==0;break;case 6:c=(s*i%2+s*i%3)%2==0;break;case 7:c=((s+i)%2+s*i%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[i][s]&&c&&(this.modules[i][s]=!this.modules[i][s])}}getPenaltyScore(){let o=0;for(let m=0;m<this.size;m++){let p=!1,f=0,d=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[m][h]==p?(f++,f==5?o+=t.PENALTY_N1:f>5&&o++):(this.finderPenaltyAddHistory(f,d),p||(o+=this.finderPenaltyCountPatterns(d)*t.PENALTY_N3),p=this.modules[m][h],f=1);o+=this.finderPenaltyTerminateAndCount(p,f,d)*t.PENALTY_N3}for(let m=0;m<this.size;m++){let p=!1,f=0,d=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][m]==p?(f++,f==5?o+=t.PENALTY_N1:f>5&&o++):(this.finderPenaltyAddHistory(f,d),p||(o+=this.finderPenaltyCountPatterns(d)*t.PENALTY_N3),p=this.modules[h][m],f=1);o+=this.finderPenaltyTerminateAndCount(p,f,d)*t.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let p=0;p<this.size-1;p++){let f=this.modules[m][p];f==this.modules[m][p+1]&&f==this.modules[m+1][p]&&f==this.modules[m+1][p+1]&&(o+=t.PENALTY_N2)}let i=0;for(let m of this.modules)i=m.reduce((p,f)=>p+(f?1:0),i);let s=this.size*this.size,c=Math.ceil(Math.abs(i*20-s*10)/s)-1;return r(0<=c&&c<=9),o+=c*t.PENALTY_N4,r(0<=o&&o<=2568888),o}getAlignmentPatternPositions(){if(this.version==1)return[];{let o=Math.floor(this.version/7)+2,i=this.version==32?26:Math.ceil((this.version*4+4)/(o*2-2))*2,s=[6];for(let c=this.size-7;s.length<o;c-=i)s.splice(1,0,c);return s}}static getNumRawDataModules(o){if(o<t.MIN_VERSION||o>t.MAX_VERSION)throw new RangeError("Version number out of range");let i=(16*o+128)*o+64;if(o>=2){let s=Math.floor(o/7)+2;i-=(25*s-10)*s-55,o>=7&&(i-=36)}return r(208<=i&&i<=29648),i}static getNumDataCodewords(o,i){return Math.floor(t.getNumRawDataModules(o)/8)-t.ECC_CODEWORDS_PER_BLOCK[i.ordinal][o]*t.NUM_ERROR_CORRECTION_BLOCKS[i.ordinal][o]}static reedSolomonComputeDivisor(o){if(o<1||o>255)throw new RangeError("Degree out of range");let i=[];for(let c=0;c<o-1;c++)i.push(0);i.push(1);let s=1;for(let c=0;c<o;c++){for(let m=0;m<i.length;m++)i[m]=t.reedSolomonMultiply(i[m],s),m+1<i.length&&(i[m]^=i[m+1]);s=t.reedSolomonMultiply(s,2)}return i}static reedSolomonComputeRemainder(o,i){let s=i.map(c=>0);for(let c of o){let m=c^s.shift();s.push(0),i.forEach((p,f)=>s[f]^=t.reedSolomonMultiply(p,m))}return s}static reedSolomonMultiply(o,i){if(o>>>8||i>>>8)throw new RangeError("Byte out of range");let s=0;for(let c=7;c>=0;c--)s=s<<1^(s>>>7)*285,s^=(i>>>c&1)*o;return r(s>>>8==0),s}finderPenaltyCountPatterns(o){let i=o[1];r(i<=this.size*3);let s=i>0&&o[2]==i&&o[3]==i*3&&o[4]==i&&o[5]==i;return(s&&o[0]>=i*4&&o[6]>=i?1:0)+(s&&o[6]>=i*4&&o[0]>=i?1:0)}finderPenaltyTerminateAndCount(o,i,s){return o&&(this.finderPenaltyAddHistory(i,s),i=0),i+=this.size,this.finderPenaltyAddHistory(i,s),this.finderPenaltyCountPatterns(s)}finderPenaltyAddHistory(o,i){i[0]==0&&(o+=this.size),i.pop(),i.unshift(o)}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}u.QrCode=t;function e(l,o,i){if(o<0||o>31||l>>>o)throw new RangeError("Value out of range");for(let s=o-1;s>=0;s--)i.push(l>>>s&1)}function n(l,o){return(l>>>o&1)!=0}function r(l){if(!l)throw new Error("Assertion error")}class a{constructor(o,i,s){this.mode=o;this.numChars=i;this.bitData=s;if(i<0)throw new RangeError("Invalid argument");this.bitData=s.slice()}mode;numChars;bitData;static makeBytes(o){let i=[];for(let s of o)e(s,8,i);return new a(a.Mode.BYTE,o.length,i)}static makeNumeric(o){if(!a.isNumeric(o))throw new RangeError("String contains non-numeric characters");let i=[];for(let s=0;s<o.length;){let c=Math.min(o.length-s,3);e(parseInt(o.substr(s,c),10),c*3+1,i),s+=c}return new a(a.Mode.NUMERIC,o.length,i)}static makeAlphanumeric(o){if(!a.isAlphanumeric(o))throw new RangeError("String contains unencodable characters in alphanumeric mode");let i=[],s;for(s=0;s+2<=o.length;s+=2){let c=a.ALPHANUMERIC_CHARSET.indexOf(o.charAt(s))*45;c+=a.ALPHANUMERIC_CHARSET.indexOf(o.charAt(s+1)),e(c,11,i)}return s<o.length&&e(a.ALPHANUMERIC_CHARSET.indexOf(o.charAt(s)),6,i),new a(a.Mode.ALPHANUMERIC,o.length,i)}static makeSegments(o){return o==""?[]:a.isNumeric(o)?[a.makeNumeric(o)]:a.isAlphanumeric(o)?[a.makeAlphanumeric(o)]:[a.makeBytes(a.toUtf8ByteArray(o))]}static makeEci(o){let i=[];if(o<0)throw new RangeError("ECI assignment value out of range");if(o<128)e(o,8,i);else if(o<16384)e(2,2,i),e(o,14,i);else if(o<1e6)e(6,3,i),e(o,21,i);else throw new RangeError("ECI assignment value out of range");return new a(a.Mode.ECI,0,i)}static isNumeric(o){return a.NUMERIC_REGEX.test(o)}static isAlphanumeric(o){return a.ALPHANUMERIC_REGEX.test(o)}getData(){return this.bitData.slice()}static getTotalBits(o,i){let s=0;for(let c of o){let m=c.mode.numCharCountBits(i);if(c.numChars>=1<<m)return 1/0;s+=4+m+c.bitData.length}return s}static toUtf8ByteArray(o){o=encodeURI(o);let i=[];for(let s=0;s<o.length;s++)o.charAt(s)!="%"?i.push(o.charCodeAt(s)):(i.push(parseInt(o.substr(s+1,2),16)),s+=2);return i}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}u.QrSegment=a})(Lt||={});(e=>{let t;(r=>{class n{constructor(u,l){this.ordinal=u;this.formatBits=l}ordinal;formatBits;static LOW=new n(0,1);static MEDIUM=new n(1,0);static QUARTILE=new n(2,3);static HIGH=new n(3,2)}r.Ecc=n})(t=e.QrCode||={})})(Lt||={});(e=>{let t;(r=>{class n{constructor(u,l){this.modeBits=u;this.numBitsCharCount=l}modeBits;numBitsCharCount;static NUMERIC=new n(1,[10,12,14]);static ALPHANUMERIC=new n(2,[9,11,13]);static BYTE=new n(4,[8,16,16]);static KANJI=new n(8,[8,10,12]);static ECI=new n(7,[0,0,0]);numCharCountBits(u){return this.numBitsCharCount[Math.floor((u+7)/17)]}}r.Mode=n})(t=e.QrSegment||={})})(Lt||={});var H=Lt;var ct={L:H.QrCode.Ecc.LOW,M:H.QrCode.Ecc.MEDIUM,Q:H.QrCode.Ecc.QUARTILE,H:H.QrCode.Ecc.HIGH},Ht=128,At="Q",tt="#FFFFFF",Vt="#000000";var Xt=0;var jt=.1;import{z as lt}from"zod";var Wn=["none","banner-bottom","banner-top","border","rounded-border","speech-bubble","banner-top-bottom","speech-bubble-top","chat-bubble","circle","polaroid","phone","ticket","badge","envelope","tag","menu-card","sticker","gradient-border","focus"],et=24,qe="Scan me",Tt=.5,gt=1.5,Zn=lt.enum(Wn),pe=lt.object({style:Zn,text:lt.string().max(et).optional(),color:lt.string().optional(),textColor:lt.string().optional(),secondaryText:lt.string().max(et).optional(),secondaryColor:lt.string().optional(),fontScale:lt.number().min(Tt).max(gt).optional()});import{z as C}from"zod";function Wt(t,e=3){let n=10**e;return Math.round(t*n)/n+0}function x(t,e=3){return String(Wt(t,e))}function O(t,...e){let n=t[0]??"";for(let r=0;r<e.length;r++){let a=e[r];n+=(typeof a=="number"?x(a):a)+(t[r+1]??"")}return n}var Kn={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},Jn=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,fe=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function Zt(t,e=Number.POSITIVE_INFINITY){if(!Jn.test(t))return null;let n=[],r=0,a=()=>{for(;r<t.length&&/[\s,]/.test(t[r]);)r++},u=()=>{a(),fe.lastIndex=r;let i=fe.exec(t);if(!i)return null;let s=i[0],c=s.indexOf(".");if(c>=0&&s.length-c-1>e)return null;r=fe.lastIndex;let m=Number(s);return Number.isFinite(m)?m:null},l=()=>{a();let i=t[r];return i==="0"||i==="1"?(r++,i==="1"?1:0):null},o=()=>(a(),r<t.length&&/[0-9.+-]/.test(t[r]));for(a();r<t.length;){let i=t[r],s=i.toUpperCase(),c=Kn[s];if(c===void 0||n.length===0&&s!=="M")return null;if(r++,c===0){n.push({command:i,values:[]}),a();continue}let m=i,p=!0;for(;p||o();){let f=[];for(let d=0;d<c;d++){let h=s==="A"&&(d===3||d===4)?l():u();if(h===null)return null;f.push(h)}n.push({command:m,values:f}),s==="M"&&(m=i==="M"?"L":"l"),p=!1}a()}return n}function ze(t){let e=0;for(let{command:n}of t)e+=n.toUpperCase()==="A"?4:1;return e}function ke(t,e=1,n=0,r=0){let a="";for(let{command:u,values:l}of t){let o=u.toUpperCase(),i=u===o,s=i?n:0,c=i?r:0,m;switch(o){case"Z":m=[];break;case"H":m=[x(l[0]*e+s)];break;case"V":m=[x(l[0]*e+c)];break;case"A":m=[x(Math.abs(l[0])*e),x(Math.abs(l[1])*e),x(l[2]),String(l[3]),String(l[4]),x(l[5]*e+s),x(l[6]*e+c)];break;default:m=l.map((p,f)=>x(p*e+(f%2===0?s:c)))}a+=u+m.join(" ")}return a}function Be(t,e=.25){let n=[],r=[],a=[0,0],u=[0,0],l=()=>{r.length>2&&n.push(r),r=[]};for(let o of t)if(o.op==="M")l(),a=[o.x,o.y],u=a,r.push(a);else if(o.op==="L")u=[o.x,o.y],r.push(u);else if(o.op==="C"){let i=u,s=[o.x1,o.y1],c=[o.x2,o.y2],m=[o.x,o.y],p=Math.hypot(s[0]-i[0],s[1]-i[1])+Math.hypot(c[0]-s[0],c[1]-s[1])+Math.hypot(m[0]-c[0],m[1]-c[1]),f=Math.max(2,Math.min(64,Math.ceil(Math.sqrt(p/(4*e)))));for(let d=1;d<=f;d++){let h=d/f,b=1-h;r.push([b*b*b*i[0]+3*b*b*h*s[0]+3*b*h*h*c[0]+h*h*h*m[0],b*b*b*i[1]+3*b*b*h*s[1]+3*b*h*h*c[1]+h*h*h*m[1]])}u=m}else l(),u=a;return l(),n}function Ge(t,e){let n=[a=>a[0]-e.x0,a=>e.x1-a[0],a=>a[1]-e.y0,a=>e.y1-a[1]],r=t;for(let a of n){if(r.length===0)break;let u=r;r=[];for(let l=0;l<u.length;l++){let o=u[l],i=u[(l+u.length-1)%u.length],s=a(o),c=a(i);s>=0?(c<0&&r.push(De(i,o,c,s)),r.push(o)):c>=0&&r.push(De(i,o,c,s))}}return r.length>2?r:[]}function De(t,e,n,r){let a=n/(n-r);return[t[0]+(e[0]-t[0])*a,t[1]+(e[1]-t[1])*a]}function Qe(t){return t.filter(e=>e.length>2).map(e=>`M${e.map(([n,r])=>`${x(n)} ${x(r)}`).join("L")}Z`).join("")}function Ue(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY,u=(l,o)=>{e=Math.min(e,l),n=Math.min(n,o),r=Math.max(r,l),a=Math.max(a,o)};for(let l of t)l.op==="C"?(u(l.x1,l.y1),u(l.x2,l.y2),u(l.x,l.y)):l.op!=="Z"&&u(l.x,l.y);return Number.isFinite(e)?{x0:e,y0:n,x1:r,y1:a}:null}var de=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function tr(t,e,n,r,a,u,l,o,i){if(t===o&&e===i)return[];let s=Math.abs(n),c=Math.abs(r);if(s===0||c===0)return[{op:"L",x:o,y:i}];let m=a*Math.PI/180,p=Math.cos(m),f=Math.sin(m),d=(t-o)/2,h=(e-i)/2,b=p*d+f*h,g=-f*d+p*h,y=b*b/(s*s)+g*g/(c*c);y>1&&(s*=Math.sqrt(y),c*=Math.sqrt(y));let S=s*s*c*c-s*s*g*g-c*c*b*b,E=s*s*g*g+c*c*b*b,R=(u===l?-1:1)*Math.sqrt(Math.max(0,S/E)),M=R*s*g/c,P=-R*c*b/s,_=p*M-f*P+(t+o)/2,I=f*M+p*P+(e+i)/2,G=(Y,X,W,Ct)=>Math.atan2(Y*Ct-X*W,Y*W+X*Ct),Q=G(1,0,(b-M)/s,(g-P)/c),Z=G((b-M)/s,(g-P)/c,(-b-M)/s,(-g-P)/c);!l&&Z>0?Z-=2*Math.PI:l&&Z<0&&(Z+=2*Math.PI);let K=Math.max(1,Math.ceil(Math.abs(Z)/(Math.PI/2)-1e-9)),U=Z/K,at=4/3*Math.tan(U/4),ft=(Y,X)=>[_+s*p*Y-c*f*X,I+s*f*Y+c*p*X],Mt=[];for(let Y=0;Y<K;Y++){let X=Q+Y*U,W=X+U,[Ct,Gt]=ft(Math.cos(X)-at*Math.sin(X),Math.sin(X)+at*Math.cos(X)),[wt,v]=ft(Math.cos(W)+at*Math.sin(W),Math.sin(W)-at*Math.cos(W)),[J,st]=Y===K-1?[o,i]:ft(Math.cos(W),Math.sin(W));Mt.push({op:"C",x1:Ct,y1:Gt,x2:wt,y2:v,x:J,y:st})}return Mt}function Kt(t){let e=[],n=0,r=0,a=0,u=0,l=0,o="",i=null,s=null,c=()=>{for(;n<t.length&&/[\s,]/.test(t[n]);)n++},m=()=>{c(),de.lastIndex=n;let d=de.exec(t);return d?(n=de.lastIndex,Number(d[0])):null},p=()=>{c();let d=t[n];return d==="0"||d==="1"?(n++,d==="1"):null},f=d=>{let h=[];for(let b=0;b<d;b++){let g=m();if(g===null)return null;h.push(g)}return h};for(;c(),!(n>=t.length);){let d=t[n];if(/[MmLlHhVvCcSsQqTtAaZz]/.test(d))o=d,n++;else if(!o||o==="Z"||o==="z")break;let h=o===o.toLowerCase(),b=h?r:0,g=h?a:0,y=o.toUpperCase();if(y==="Z"){e.push({op:"Z"}),r=u,a=l,i=null,s=null;continue}if(y==="A"){let M=f(3),P=p(),_=p(),I=f(2);if(!(M&&I)||P===null||_===null)break;let[G,Q,Z]=M,K=I[0]+b,U=I[1]+g;e.push(...tr(r,a,G,Q,Z,P,_,K,U)),r=K,a=U,i=null,s=null;continue}let S={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2}[y]??0,E=f(S);if(!E)break;let R=E;switch(y){case"M":r=R[0]+b,a=R[1]+g,u=r,l=a,e.push({op:"M",x:r,y:a}),o=h?"l":"L",i=null,s=null;break;case"L":case"H":case"V":y!=="V"&&(r=R[0]+b),y==="V"?a=R[0]+g:y==="L"&&(a=R[1]+g),e.push({op:"L",x:r,y:a}),i=null,s=null;break;case"C":case"S":{let M,P;y==="C"?(M=[R[0]+b,R[1]+g],P=R.slice(2)):(M=i?[2*r-i[0],2*a-i[1]]:[r,a],P=R);let _=[P[0]+b,P[1]+g],I=[P[2]+b,P[3]+g];e.push({op:"C",x1:M[0],y1:M[1],x2:_[0],y2:_[1],x:I[0],y:I[1]}),[r,a]=I,i=_,s=null;break}case"Q":case"T":{let M,P;y==="Q"?(M=[R[0]+b,R[1]+g],P=[R[2]+b,R[3]+g]):(M=s?[2*r-s[0],2*a-s[1]]:[r,a],P=[R[0]+b,R[1]+g]),e.push({op:"C",x1:r+2/3*(M[0]-r),y1:a+2/3*(M[1]-a),x2:P[0]+2/3*(M[0]-P[0]),y2:P[1]+2/3*(M[1]-P[1]),x:P[0],y:P[1]}),[r,a]=P,s=M,i=null;break}default:break}}return e}var Ye=.5522847498;function he(t,e,n,r,a=0,u=0){if(n<=0||r<=0)return[];let l=Math.min(Math.max(a,0),n/2),o=Math.min(Math.max(u,0),r/2);if(l===0||o===0)return[{op:"M",x:t,y:e},{op:"L",x:t+n,y:e},{op:"L",x:t+n,y:e+r},{op:"L",x:t,y:e+r},{op:"Z"}];let i=l*Ye,s=o*Ye,c=t+n,m=e+r;return[{op:"M",x:t+l,y:e},{op:"L",x:c-l,y:e},{op:"C",x1:c-l+i,y1:e,x2:c,y2:e+o-s,x:c,y:e+o},{op:"L",x:c,y:m-o},{op:"C",x1:c,y1:m-o+s,x2:c-l+i,y2:m,x:c-l,y:m},{op:"L",x:t+l,y:m},{op:"C",x1:t+l-i,y1:m,x2:t,y2:m-o+s,x:t,y:m-o},{op:"L",x:t,y:e+o},{op:"C",x1:t,y1:e+o-s,x2:t+l-i,y2:e,x:t+l,y:e},{op:"Z"}]}var er="qrdx.frame",nr=1,ye="custom",N={minArtboard:50,maxArtboard:2e3,maxCoordinate:4e3,maxDecimals:3,maxShapes:64,maxLabels:8,maxPolygonPoints:256,maxPathLength:16e3,maxSegments:2e3,maxGradientSteps:64,maxGradientWork:16e3,maxBytes:32768,minQrShare:.5,minPadding:.04,defaultPadding:.08,maxTextLength:et},rr=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],xe=.95,or=200,ir=["frame","text","accent","background"],ar=/[\t\n\v\f\r\u0085\u2028\u2029]/g,sr=/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180f\u200b-\u200f\u202a-\u202e\u2060-\u206f\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff0-\ufffb]|\udb40[\udc00-\udcff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;function Se(t,e=et){let n=t.slice(0,1e3).normalize("NFC").replace(ar," ").replace(sr,"").replace(/\s+/g," ").trim();return Array.from(n).slice(0,Math.max(0,e)).join("").trim()}var Ee=t=>Math.abs(t*1e3-Math.round(t*1e3))<1e-6,T=C.number().min(-N.maxCoordinate).max(N.maxCoordinate).refine(Ee,{message:`Numbers may have at most ${N.maxDecimals} decimals`}),D=T.refine(t=>t>0,{message:"Must be greater than 0"}),te=T.refine(t=>t>=0,{message:"Must not be negative"}),Jt=C.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color"),ge=C.union([C.enum(ir),Jt]),Nt=C.union([ge,C.object({mix:C.tuple([ge,ge]),amount:C.number().min(0).max(1).refine(Ee)}).strict()]),bt=C.union([Nt,C.object({gradient:C.object({from:Nt,to:Nt,direction:C.enum(["horizontal","vertical"]).optional(),steps:C.int().min(2).max(N.maxGradientSteps).optional()}).strict()}).strict()]),be={x:T,y:T,width:D,height:D},cr=C.object({type:C.literal("rect"),...be,radius:te.optional(),fill:bt,hole:C.object({...be,radius:te.optional()}).strict().optional()}).strict(),lr=C.object({type:C.literal("circle"),cx:T,cy:T,r:D,hole:D.optional(),fill:bt}).strict(),ur=C.object({type:C.literal("ellipse"),cx:T,cy:T,rx:D,ry:D,fill:bt}).strict(),mr=C.object({type:C.literal("polygon"),points:C.array(C.tuple([T,T])).min(3).max(N.maxPolygonPoints),fill:bt}).strict(),pr=C.object({type:C.literal("path"),d:C.string().min(2).max(N.maxPathLength),fill:bt,fillRule:C.enum(["nonzero","evenodd"]).optional()}).strict(),fr=C.object({type:C.literal("line"),x1:T,y1:T,x2:T,y2:T,width:D,cap:C.enum(["butt","round"]).optional(),dash:C.tuple([D,D]).optional(),fill:bt}).strict(),dr=C.object({type:C.literal("icon"),icon:C.enum(rr),x:T,y:T,size:D,fill:bt}).strict(),hr=C.discriminatedUnion("type",[cr,lr,ur,mr,pr,fr,dr]),Ve={id:C.string().regex(/^[a-z][a-z0-9-]{0,31}$/),slot:C.enum(["primary","secondary","fixed"]),text:C.string().max(200),maxLength:C.int().min(1).max(et).optional(),color:Nt,weight:C.enum(["bold","regular"]).optional()},gr=C.object({type:C.literal("text"),...Ve,box:C.object(be).strict(),align:C.enum(["start","middle","end"]).optional(),fontSize:D.optional()}).strict(),br=C.object({type:C.literal("curved"),...Ve,curve:C.object({cx:T,cy:T,radius:D,side:C.enum(["top","bottom"]),spread:C.number().min(20).max(300).refine(Ee).optional()}).strict(),fontSize:D}).strict(),yr=C.discriminatedUnion("type",[gr,br]),He=T.refine(t=>t>=N.minArtboard&&t<=N.maxArtboard,{message:`Artboard sides must be ${N.minArtboard} to ${N.maxArtboard} units`}),xr=C.object({kind:C.literal(er),version:C.literal(nr),artboard:C.object({width:He,height:He}).strict(),qr:C.object({x:T,y:T,size:D,padding:te.optional(),radius:te.optional()}).strict(),colors:C.object({frame:Jt,text:Jt.optional(),accent:Jt.optional()}).strict(),shapes:C.array(hr).max(N.maxShapes),labels:C.array(yr).max(N.maxLabels),bleed:C.union([C.literal("none"),Nt]).optional()}).strict();function Sr(t){let e=ee(t);return{x0:t.qr.x-e,y0:t.qr.y-e,x1:t.qr.x+t.qr.size+e,y1:t.qr.y+t.qr.size+e}}function ee(t){return t.qr.padding??t.qr.size*N.defaultPadding}var Er=(t,e)=>Math.min(t.x1,e.x1)-Math.max(t.x0,e.x0)>1e-6&&Math.min(t.y1,e.y1)-Math.max(t.y0,e.y0)>1e-6;function Mr(t){switch(t.type){case"rect":return{bounds:{x0:t.x,y0:t.y,x1:t.x+t.width,y1:t.y+t.height},segments:t.hole?18:9};case"circle":return{bounds:{x0:t.cx-t.r,y0:t.cy-t.r,x1:t.cx+t.r,y1:t.cy+t.r},segments:t.hole?10:5};case"ellipse":return{bounds:{x0:t.cx-t.rx,y0:t.cy-t.ry,x1:t.cx+t.rx,y1:t.cy+t.ry},segments:5};case"polygon":{let e=t.points.map(([r])=>r),n=t.points.map(([,r])=>r);return{bounds:{x0:Math.min(...e),y0:Math.min(...n),x1:Math.max(...e),y1:Math.max(...n)},segments:t.points.length}}case"path":{let e=Zt(t.d,N.maxDecimals);return e?{bounds:Ue(Kt(t.d)),segments:ze(e)}:{bounds:null,segments:0}}case"line":{let e=t.width/2,n=Math.hypot(t.x2-t.x1,t.y2-t.y1),r=t.dash?Math.ceil(n/(t.dash[0]+t.dash[1])):1;return{bounds:{x0:Math.min(t.x1,t.x2)-e,y0:Math.min(t.y1,t.y2)-e,x1:Math.max(t.x1,t.x2)+e,y1:Math.max(t.y1,t.y2)+e},segments:r*(t.cap==="round"?4:5)}}default:return{bounds:{x0:t.x,y0:t.y,x1:t.x+t.size,y1:t.y+t.size},segments:or}}}function Cr(t,e){let n=(g,y=[])=>e.addIssue({code:"custom",message:g,path:y}),r=N,a=new TextEncoder().encode(JSON.stringify(t)).length;if(a>r.maxBytes){n(`The spec is ${a} bytes; the limit is ${r.maxBytes}`);return}let{width:u,height:l}=t.artboard,o=Math.max(u,l)*.005,i={x0:-o,y0:-o,x1:u+o,y1:l+o},s=g=>g.x0>=i.x0&&g.y0>=i.y0&&g.x1<=i.x1&&g.y1<=i.y1,{qr:c}=t,m=ee(t);m<c.size*r.minPadding-1e-9&&n(`qr.padding must be at least ${r.minPadding*100}% of qr.size`,["qr","padding"]),c.size<Math.min(u,l)*r.minQrShare-1e-9&&n(`qr.size must be at least ${r.minQrShare*100}% of the artboard's shorter side`,["qr","size"]);let p=Sr(t);(p.x0<-1e-9||p.y0<-1e-9||p.x1>u+1e-9||p.y1>l+1e-9)&&n("The code and its padding must sit inside the artboard",["qr"]),(c.radius??0)>(c.size+2*m)/2&&n("qr.radius is larger than half the plate",["qr","radius"]);let f=0,d=0;t.shapes.forEach((g,y)=>{let S=["shapes",y],{bounds:E,segments:R}=Mr(g);if(!E){n("Path data must use only M L H V C S Q T A Z, plain numbers (up to 3 decimals) and start with M",[...S,"d"]);return}if(s(E)||n("The shape extends outside the artboard",S),g.type==="rect"&&g.hole){let{hole:M}=g;(M.x<g.x||M.y<g.y||M.x+M.width>g.x+g.width+1e-9||M.y+M.height>g.y+g.height+1e-9)&&n("The hole must sit inside its rect",[...S,"hole"])}g.type==="circle"&&g.hole&&g.hole>=g.r&&n("The hole must be smaller than the circle",[...S,"hole"]),f+=R,typeof g.fill=="object"&&"gradient"in g.fill&&(d+=(g.fill.gradient.steps??32)*R)}),f>r.maxSegments&&n(`The shapes have ${f} segments; the limit is ${r.maxSegments}`,["shapes"]),d>r.maxGradientWork&&n("Gradient fills are too detailed (fewer steps or simpler shapes)",["shapes"]);let h=new Set,b=new Set;t.labels.forEach((g,y)=>{let S=["labels",y];h.has(g.id)&&n(`Label id "${g.id}" is used twice`,[...S,"id"]),h.add(g.id),g.slot!=="fixed"&&(b.has(g.slot)&&n(`Only one label may use the ${g.slot} slot`,[...S,"slot"]),b.add(g.slot));let E=g.maxLength??r.maxTextLength;g.text!==Se(g.text,E)&&n(`Label text must be at most ${E} characters, trimmed, with no control or invisible characters (see sanitizeFrameText)`,[...S,"text"]);let R;if(g.type==="text")R={x0:g.box.x,y0:g.box.y,x1:g.box.x+g.box.width,y1:g.box.y+g.box.height},g.fontSize!==void 0&&g.fontSize>g.box.height*xe+1e-9&&n("fontSize may be at most 95% of the label's row height",[...S,"fontSize"]),Er(R,p)&&n("The label overlaps the code or its padding",[...S,"box"]);else{let{cx:M,cy:P,radius:_}=g.curve,I=g.fontSize*gt*.6;R={x0:M-_-I,y0:P-_-I,x1:M+_+I,y1:P+_+I};let G=Math.hypot(Math.max(p.x0-M,0,M-p.x1),Math.max(p.y0-P,0,P-p.y1));Math.hypot(Math.max(Math.abs(p.x0-M),Math.abs(p.x1-M)),Math.max(Math.abs(p.y0-P),Math.abs(p.y1-P)))<=_-I||G>=_+I||n("The curved label crosses the code or its padding",[...S,"curve"])}s(R)||n("The label extends outside the artboard",S)})}var Me=xr.superRefine(Cr);var Rr=pe.extend({style:C.literal(ye),spec:Me}),Xe=C.discriminatedUnion("style",[pe,Rr]);function B(t){if(t.length===0)return"";let[e,...n]=t;return`M${x(e[0])} ${x(e[1])}${n.map(([r,a])=>`L${x(r)} ${x(a)}`).join("")}Z`}function $(t,e,n){return`M${x(t-n)} ${x(e)}A${x(n)} ${x(n)} 0 1 1 ${x(t+n)} ${x(e)}A${x(n)} ${x(n)} 0 1 1 ${x(t-n)} ${x(e)}Z`}function A(t,e,n,r,a=0){let u=Math.min(n,r)/2,[l,o,i,s]=(typeof a=="number"?[a,a,a,a]:a).map(m=>Math.max(0,Math.min(m,u))),c=(m,p,f)=>m>0?`A${x(m)} ${x(m)} 0 0 1 ${x(p)} ${x(f)}`:"";return`M${x(t+l)} ${x(e)}H${x(t+n-o)}${c(o,t+n,e+o)}V${x(e+r-i)}${c(i,t+n-i,e+r)}H${x(t+s)}${c(s,t,e+r-s)}V${x(e+l)}${c(l,t+l,e)}Z`}function ne(t,e,n,r,a=5){return Array.from({length:a*2},(u,l)=>{let o=l%2===0?n:r,i=-Math.PI/2+Math.PI/a*l;return[t+o*Math.cos(i),e+o*Math.sin(i)]})}function je(t,e,n){let r=n/2,a=(u,l)=>`${x(t+u*r)} ${x(e+l*r)}`;return`M${a(0,-.52)}C${a(.18,-.92)} ${a(.98,-.94)} ${a(1,-.34)}C${a(1,.12)} ${a(.5,.48)} ${a(0,.92)}C${a(-.5,.48)} ${a(-1,.12)} ${a(-1,-.34)}C${a(-.98,-.94)} ${a(-.18,-.92)} ${a(0,-.52)}Z`}function Ce(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(36)}var We=24,ut=(t,e,n,r)=>{let a=r*Math.PI/180;return[t+n*Math.cos(a),e+n*Math.sin(a)]},re=([t,e])=>`${x(t)} ${x(e)}`;function $t(t,e,n,r,a,u){let l=u-a>180?1:0;return`M${re(ut(t,e,r,a))}A${x(r)} ${x(r)} 0 ${l} 1 ${re(ut(t,e,r,u))}L${re(ut(t,e,n,u))}A${x(n)} ${x(n)} 0 ${l} 0 ${re(ut(t,e,n,a))}Z`}function Ot(t,e,n,r){return`M${x(t-n)} ${x(e)}A${x(n)} ${x(r)} 0 1 1 ${x(t+n)} ${x(e)}A${x(n)} ${x(r)} 0 1 1 ${x(t-n)} ${x(e)}Z`}function Pr(t){let e=0;return t.forEach(([n,r],a)=>{let[u,l]=t[(a+1)%t.length];e+=n*l-u*r}),e/2}function Ze(t){return B(Pr(t)<0?[...t].reverse():t)}function oe(t,e,n,r,a){let u=Math.hypot(n-t,r-e)||1,l=-(r-e)/u*(a/2),o=(n-t)/u*(a/2);return Ze([[t+l,e+o],[n+l,r+o],[n-l,r-o],[t-l,e-o]])}var z=(...t)=>({d:t.join(""),fillRule:"nonzero"}),nt=(...t)=>({d:t.join(""),fillRule:"evenodd"});function Lr(){let t=[];for(let e of[0,60,120]){let[n,r]=ut(12,12,10.5,e+180),[a,u]=ut(12,12,10.5,e);t.push(oe(n,r,a,u,2))}for(let e=0;e<6;e++){let n=e*60,[r,a]=ut(12,12,6.2,n);for(let u of[-45,45]){let[l,o]=ut(r,a,3.6,n+u);t.push(oe(r,a,l,o,1.7))}}return z(...t)}var Ar={wifi:()=>z($t(12,20,4.6,7.2,-135,-45),$t(12,20,9.2,11.8,-135,-45),$t(12,20,13.8,16.4,-135,-45),$(12,20,2.2)),star:()=>z(B(ne(12,12.8,11.6,4.8))),heart:()=>z(je(12,12.4,22)),phone:()=>nt(A(6,1.5,12,21,2.6),A(7.8,4.2,8.4,13.4,.6),$(12,19.8,1.1)),headphones:()=>z($t(12,13,7.6,9.8,-180,0),A(2,12,5,9.5,2),A(17,12,5,9.5,2)),calendar:()=>nt(A(2.5,4,19,17.5,2.5),A(4.6,9,14.8,10.6,.8),A(7,11.4,2.6,2.6,.4),A(10.7,11.4,2.6,2.6,.4),A(14.4,11.4,2.6,2.6,.4),A(7,15.1,2.6,2.6,.4),A(10.7,15.1,2.6,2.6,.4),A(6.5,1.4,2.4,2.6,[1.2,1.2,0,0]),A(15.1,1.4,2.4,2.6,[1.2,1.2,0,0])),user:()=>z($(12,7.5,4.6),"M3 21.5C3 16.2 7 13.6 12 13.6C17 13.6 21 16.2 21 21.5Z"),chat:()=>nt(A(2,3,20,14,4),B([[6.5,17],[11.5,17],[5.8,21.8]]),$(7.5,10,1.5),$(12,10,1.5),$(16.5,10,1.5)),bag:()=>z(A(3.5,7.5,17,14.5,2),$t(12,7.5,3.1,4.8,-180,0)),bell:()=>z("M3.5 17.2A8.5 8.5 0 0 1 20.5 17.2Z",A(1.5,18.2,21,2.6,1.3),A(11.2,6.6,1.6,2.6,0),A(9.8,4.6,4.4,2.4,1.2)),cup:()=>z("M4 6.5H17V13.5A6.5 6.5 0 0 1 4 13.5Z",$t(17,10.2,1.7,3.6,-90,90),A(2,20.6,17,2,1),A(7,1.6,1.6,3.4,.8),A(11.6,1.6,1.6,3.4,.8)),card:()=>nt(A(1.5,4.5,21,15,2.5),A(1.5,8,21,3,0),A(4.5,13.6,4.6,3.2,.6)),check:()=>nt($(12,12,10.5),B([[6.6,12.4],[8.4,10.6],[10.6,12.8],[15.8,7.6],[17.6,9.4],[10.6,16.4]])),info:()=>nt($(12,12,10.5),$(12,7.2,1.6),A(10.6,10,2.8,8,.8)),home:()=>nt(B([[12,2.5],[22.5,11.5],[19.5,11.5],[19.5,21.5],[4.5,21.5],[4.5,11.5],[1.5,11.5]]),A(10,14.5,4,7,[.6,.6,0,0])),pin:()=>nt("M12 22.5C8.5 17.6 4.5 14 4.5 9.5A7.5 7.5 0 0 1 19.5 9.5C19.5 14 15.5 17.6 12 22.5Z",$(12,9.5,3)),share:()=>z(oe(6,12,18,5,1.8),oe(6,12,18,19,1.8),$(18,5,3.2),$(6,12,3.2),$(18,19,3.2)),download:()=>z(A(10.6,2,2.8,9.5,0),B([[6,10],[18,10],[12,16.5]]),B([[2.5,15],[5.3,15],[5.3,19],[18.7,19],[18.7,15],[21.5,15],[21.5,21.8],[2.5,21.8]])),clock:()=>nt($(12,12,10.5),$(12,12,8.4),B([[11,5.4],[13,5.4],[13,11.3],[16.9,13.5],[15.9,15.2],[11,12.5]])),snowflake:Lr,pumpkin:()=>z(Ot(7.8,14.6,5.8,6.9),Ot(16.2,14.6,5.8,6.9),Ot(12,14.6,4.8,7.4),A(10.9,3.4,2.2,4.6,.8),Ze([[13,4.2],[17.2,3],[16.2,5.4],[13,6]])),tree:()=>z(B([[12,1.5],[16.8,8.2],[7.2,8.2]]),B([[12,5.2],[19,13.6],[5,13.6]]),B([[12,9.4],[21.2,19.2],[2.8,19.2]]),A(10.4,18.6,3.2,3.9,.4)),sparkle:()=>z(B(ne(9.5,13.5,9,2.4,4)),B(ne(19,5,4,1.1,4))),gift:()=>z(A(3,11.2,7.8,10.6,1),A(13.2,11.2,7.8,10.6,1),A(2,7.4,8.8,3.2,1),A(13.2,7.4,8.8,3.2,1),Ot(8.8,4.8,2.9,1.9),Ot(15.2,4.8,2.9,1.9))};function Ke(t){return Ar[t]()}var $r={black:[0,0,0],white:[255,255,255],red:[255,0,0],green:[0,128,0],lime:[0,255,0],blue:[0,0,255],navy:[0,0,128],yellow:[255,255,0],orange:[255,165,0],purple:[128,0,128],pink:[255,192,203],gray:[128,128,128],grey:[128,128,128],silver:[192,192,192],maroon:[128,0,0],olive:[128,128,0],teal:[0,128,128],aqua:[0,255,255],cyan:[0,255,255],fuchsia:[255,0,255],magenta:[255,0,255]};function Je(t,e){let n=t.trim(),r=Number.parseFloat(n);return Number.isNaN(r)?Number.NaN:n.endsWith("%")?r/100*e:r}function qt(t){if(!t)return null;let e=t.trim().toLowerCase();if(e==="transparent")return{r:0,g:0,b:0,a:0};let n=$r[e];if(n)return{r:n[0],g:n[1],b:n[2],a:1};if(e.startsWith("#")){let a=e.slice(1);return(a.length===3||a.length===4)&&(a=a.split("").map(u=>u+u).join("")),/^[0-9a-f]{6}([0-9a-f]{2})?$/.test(a)?{r:Number.parseInt(a.slice(0,2),16),g:Number.parseInt(a.slice(2,4),16),b:Number.parseInt(a.slice(4,6),16),a:a.length===8?Number.parseInt(a.slice(6,8),16)/255:1}:null}let r=/^rgba?\(([^)]*)\)$/.exec(e);if(r){let[a,u]=r[1].split("/"),l=a.split(/[\s,]+/).filter(Boolean);if(l.length!==(u===void 0&&l.length===4?4:3))return null;let o=u??l[3],[i,s,c]=l.slice(0,3).map(f=>Je(f,255)),m=o===void 0?1:Je(o,1);if([i,s,c,m].some(f=>Number.isNaN(f)))return null;let p=(f,d)=>Math.min(Math.max(f,0),d);return{r:p(i,255),g:p(s,255),b:p(c,255),a:p(m,1)}}return null}var Fr=["banner-top-bottom","speech-bubble-top","chat-bubble","circle","polaroid","phone","ticket","badge","envelope","tag","menu-card","sticker","gradient-border","focus"];function nn(t){return Fr.includes(t)}var tn={from:"#7c3aed",to:"#db2777"},q="#FFFFFF";function rn(t){return t===" "?.3:/[MWmw@%]/.test(t)?.92:/[A-Z0-9#&]/.test(t)?.72:/[il.,:;!'|1]/.test(t)?.32:.6}function It(t){let e=0;for(let n of t)e+=rn(n);return Math.max(e,1)}var Re=t=>Math.round(Math.min(255,Math.max(0,t))).toString(16).padStart(2,"0");function j(t,e,n){let r=qt(t)??{r:0,g:0,b:0,a:1},a=qt(e)??{r:255,g:255,b:255,a:1},u=Math.min(1,Math.max(0,n));return`#${Re(r.r+(a.r-r.r)*u)}${Re(r.g+(a.g-r.g)*u)}${Re(r.b+(a.b-r.b)*u)}`}var V=(t,e,n,r,a=0)=>({x:t,y:e,width:n,height:r,radius:a}),w=(t,e,n,r,a,u)=>({type:"rect",...V(t,e,n,r,a),fill:u}),Ft=(t,e,n)=>({type:"rect",...t,fill:n,hole:e}),k=(t,e)=>({type:"polygon",points:t,fill:e}),mt=(t,e,n="nonzero")=>({type:"path",d:t,fill:e,fillRule:n}),on=(...t)=>t.filter(e=>e!==null),Ir=t=>{let{size:e,gap:n,border:r,band:a,color:u,background:l,frame:o,fitLabel:i}=t,s=e+2*(r+n),c=s-2*r,m=e+2*n,p=a+m+a,f=c-2*n,d=o.textColor||q;return{width:s,height:p,qrX:r+n,qrY:a+n,qrSize:e,shapes:[w(r,a,c,m,0,l),Ft(V(0,0,s,p),V(r,a,c,m),u)],label:i(t.text,s/2,a/2,a,f,d),extraLabels:on(i(t.secondaryText,s/2,a+m+a/2,a,f,d,"secondaryText")),squareEdges:!0,color:u}},wr=t=>{let{size:e,gap:n,border:r,band:a,color:u,background:l,frame:o,fitLabel:i}=t,s=e+2*(r+n),c=s-2*r,m=e*.07,p=Math.max(m-r,0),f=e*.025,d=e*.08,h=a+d+f;return{width:s,height:h+s,qrX:r+n,qrY:h+r+n,qrSize:e,shapes:[w(0,0,s,a,a/2,u),k([[s/2-d,a-d/2],[s/2+d,a-d/2],[s/2,a+d]],u),w(r,h+r,c,c,p,l),Ft(V(0,h,s,s,m),V(r,h+r,c,c,p),u)],label:i(t.text,s/2,a/2,a,c-2*n,o.textColor||q),squareEdges:!1,color:u}},vr=t=>{let{size:e,gap:n,border:r,color:a,background:u,frame:l,fitLabel:o}=t,i=e+2*(r+n),s=i-2*r,c=e*.12,m=e+2*n,p=t.text?e*.2:r,f=r+m+p,d=e*.13,h=f-e*.02;return{width:i,height:f+d,qrX:r+n,qrY:r+n,qrSize:e,shapes:[w(0,0,i,f,c,a),mt(O`M${i*.13} ${h}L${i*.05} ${f+d}`+O`Q${i*.16} ${f+d*.45} ${i*.32} ${h}Z`,a),w(r,r,s,m,Math.max(c-r,0),u)],label:o(t.text,i/2,r+m+p/2,p,s-2*n,l.textColor||q),squareEdges:!1,color:a}};function ie(t,e,n,r,a,u,l,o){let i=[...t],s=a*.08,c=i.map(h=>rn(h)*a),m=c.reduce((h,b)=>h+b,0)+s*Math.max(0,i.length-1),p=u==="top"?r-a*.35:r+a*.35,f=[],d=0;return i.forEach((h,b)=>{let g=c[b],y=(d+g/2)/p;if(d+=g+s,h.trim()==="")return;let S=u==="top"?-Math.PI/2-m/2/p+y:Math.PI/2+m/2/p-y;f.push({text:h,x:e+p*Math.cos(S),y:n+p*Math.sin(S),fontSize:a,maxWidth:a*2,color:l,rotate:S*180/Math.PI+(u==="top"?90:-90),field:o})}),f}var _r=t=>{let{size:e,gap:n,color:r,background:a,frame:u,fontScale:l}=t,o=e*Math.SQRT1_2+n*.9,i=e*.21,s=o+i,c=o+i/2,m=s,p=u.textColor||q,f=c*(140*Math.PI/180),d=y=>Math.min(i*.5*l,f/(It(y)+.08*y.length)),h=t.text?ie(t.text,m,m,c,d(t.text),"top",p,"text"):[],b=t.secondaryText?ie(t.secondaryText,m,m,c,d(t.secondaryText),"bottom",p,"secondaryText"):[],g=i*.07;return{width:2*s,height:2*s,qrX:m-e/2,qrY:m-e/2,qrSize:e,shapes:[mt($(m,m,o),a),mt($(m,m,s)+$(m,m,o),r,"evenodd"),mt($(m-c,m,g)+$(m+c,m,g),p)],label:null,extraLabels:[...h,...b],squareEdges:!1,color:r}},Tr=t=>{let{size:e,gap:n,color:r,background:a,frame:u,fitLabel:l}=t,o=e*.07,i=e+2*n,s=e*.3,c=e*.025,m=i+2*o,p=o+i+s,f=e*.015;return{width:m+c,height:p+c,qrX:o+n,qrY:o+n,qrSize:e,shapes:[w(c,c,m,p,f,j(r,q,.72)),w(0,0,m,p,f,r),w(o,o,i,i,0,a)],label:l(t.text,m/2,o+i+s/2,s*.8,i-2*n,u.textColor||q),squareEdges:!1,color:r}},Nr=t=>{let{size:e,gap:n,color:r,background:a,frame:u,fitLabel:l}=t,o=e*.05,i=e*.17,s=e*.15,c=t.text?e*.17:0,m=e+2*n,p=n+e+(t.text?n*.5+c:n),f=m+2*o,d=i+p+s,h=e*.036,b=e*.03;return{width:f,height:d,qrX:o+n,qrY:i+n,qrSize:e,shapes:[w(0,0,f,d,e*.17,r),w(o,i,m,p,e*.06,a),w(f/2-e*.11,i/2-h/2,e*.22,h,h/2,a),w(f/2-e*.15,i+p+s/2-b/2,e*.3,b,b/2,a)],label:l(t.text,f/2,i+n+e+n*.5+c/2,c,m-2*n,u.textColor||r),squareEdges:!1,color:r}},Or=t=>{let{size:e,gap:n,band:r,color:a,background:u,frame:l,fitLabel:o}=t,i=e*.05,s=e+2*n,c=s+2*i,m=Wt(i+s+i*1.2),p=m+r,f=Wt(e*.055),d=e*.04,h=O`M${d} 0H${c-d}A${d} ${d} 0 0 1 ${c} ${d}`+O`V${m-f}A${f} ${f} 0 0 0 ${c} ${m+f}`+O`V${p-d}A${d} ${d} 0 0 1 ${c-d} ${p}`+O`H${d}A${d} ${d} 0 0 1 0 ${p-d}`+O`V${m+f}A${f} ${f} 0 0 0 0 ${m-f}`+O`V${d}A${d} ${d} 0 0 1 ${d} 0Z`,b=[],g=e*.03,y=e*.022,S=e*.012;for(let E=f+y;E+g<=c-f-y/2;E+=g+y)b.push(A(E,m-S/2,g,S));return{width:c,height:p,qrX:i+n,qrY:i+n,qrSize:e,shapes:[mt(h,a),w(i,i,s,s,e*.02,u),mt(b.join(""),u)],label:o(t.text,c/2,m+r/2,r,s-2*n,l.textColor||q),squareEdges:!1,color:a}},qr=t=>{let{size:e,gap:n,border:r,band:a,color:u,background:l,frame:o,fitLabel:i}=t,s=e*.18,c=e*.05,m=e+2*(r+n),p=e*.06,f=Math.max(p-r,0),d=m+2*s,h=m-r,b=s*.5,g=h+c,y=b+c*2,S=s*.28,E=j(u,"#000000",.28),R=j(u,"#000000",.5);return{width:d,height:g+a,qrX:s+r+n,qrY:r+n,qrSize:e,shapes:[k([[0,g],[y,g],[y,g+a],[0,g+a],[S,g+a/2]],E),k([[d,g],[d-S,g+a/2],[d,g+a],[d-y,g+a],[d-y,g]],E),k([[b,h+a],[b+c*1.6,h+a+c],[b,h+a+c]],R),k([[d-b,h+a],[d-b,h+a+c],[d-b-c*1.6,h+a+c]],R),w(s+r,r,m-2*r,m-2*r,f,l),Ft(V(s,0,m,m,p),V(s+r,r,m-2*r,m-2*r,f),u),w(b,h,d-2*b,a,0,u)],label:i(t.text,d/2,h+a/2,a,d-2*b-2*n,o.textColor||q),squareEdges:!1,color:u}},zr=t=>{let{size:e,gap:n,band:r,color:a,background:u,frame:l,fitLabel:o}=t,i=e*.08,s=e+2*n,c=s+2*i,m=e*.05,p=m+n+e+n*.6,f=e*.14,d=p+f+r+e*.02,h=m+e*.32,b=e*.012,g=p+f-m;return{width:c,height:d,qrX:i+n,qrY:m+n,qrSize:e,shapes:[w(0,h,c,d-h,0,j(a,q,.45)),k([[0,h],[c/2,0],[c,h]],j(a,q,.25)),w(i,m,s,g,0,u),Ft(V(i-b,m-b,s+2*b,g+b),V(i,m,s,g),a),k([[0,p],[c/2,p+f],[c,p],[c,d],[0,d]],a)],label:o(t.text,c/2,p+f+r/2,r,s-2*n,l.textColor||q),squareEdges:!1,color:a}},kr=t=>{let{size:e,gap:n,band:r,color:a,background:u,frame:l,fitLabel:o}=t,i=e*.06,s=e+2*n,c=s+2*i,m=e*.24,p=e*.04,f=m*.48,d=e*.14,h=t.text?r:i,b=m+s+h,g=e*.04,y=O`M${d} 0H${c-d}L${c} ${d}`+O`V${b-g}A${g} ${g} 0 0 1 ${c-g} ${b}`+O`H${g}A${g} ${g} 0 0 1 0 ${b-g}V${d}Z`+$(c/2,f,p);return{width:c,height:b,qrX:i+n,qrY:m+n,qrSize:e,shapes:[mt(y,a,"evenodd"),mt($(c/2,f,p*1.7)+$(c/2,f,p),j(a,q,.35),"evenodd"),w(i,m,s,s,e*.02,u)],label:o(t.text,c/2,m+s+h/2,h,s-2*n,l.textColor||q),squareEdges:!1,color:a}},Dr=t=>{let{size:e,color:n,background:r,frame:a,fitLabel:u}=t,l=e*.13,o=t.text?e*.26:l,i=t.secondaryText?e*.2:l,s=e+2*l,c=o+e+i,m=e*.03,p=e*.022,f=e*.045,d=e*.008,h=a.textColor||n,b=[w(0,0,s,c,m,r),Ft(V(0,0,s,c,m),V(p,p,s-2*p,c-2*p,Math.max(m-p,0)),n),Ft(V(f,f,s-2*f,c-2*f),V(f+d,f+d,s-2*(f+d),c-2*(f+d)),n)];if(t.text){let g=o-e*.075,y=e*.022;b.push(w(s*.3,g-d/2,s*.4,d,0,n),k([[s/2,g-y],[s/2+y,g],[s/2,g+y],[s/2-y,g]],n))}return{width:s,height:c,qrX:l,qrY:o,qrSize:e,shapes:b,label:u(t.text,s/2,e*.115,e*.17,s-2*l,h),extraLabels:on(u(t.secondaryText,s/2,o+e+i*.45,i*.8,s-2*l,h,"secondaryText")),squareEdges:!1,color:n}},Br=t=>{let{size:e,gap:n,color:r,background:a,frame:u,fitLabel:l}=t,o=e*.025,i=e*.07,s=e*.03,c=e*.13,m=t.text?e*.17:0,p=n*1.25,f=e+2*p,d=f+2*i,h=f+2*i+m,b=d+2*o,g=h+2*o;return{width:b+s,height:g+s,qrX:o+i+p,qrY:o+i+p,qrSize:e,shapes:[w(s,s,b,g,c+o,j(r,q,.7)),w(0,0,b,g,c+o,q),w(o,o,d,h,c,r),w(o+i,o+i,f,f,e*.04,a)],label:l(t.text,o+d/2,o+i+f+(i+m)/2,i+m,f-2*n,u.textColor||q),squareEdges:!1,color:r}};function en(t,e,n,r){let a=t<e+r?e+r-t:t>e+n-r?t-(e+n-r):0;return r-Math.sqrt(Math.max(0,r*r-Math.min(a,r)**2))}function Gr(t,e,n,r,a,u,l=48){let o=Math.max(n-r,0),i=t-2*r,s=new Set([r,t-r]);for(let b=0;b<=l;b++)s.add(t*b/l);let c=[...s].sort((b,g)=>b-g),m=t*.002,p=5,f=b=>en(b,0,t,n),d=b=>r+en(b,r,i,o),h=[];for(let b=0;b+1<c.length;b++){let g=c[b],y=Math.min(t,c[b+1]+(b+2<c.length?m:0)),S=j(a,u,(g+y)/2/t),E=M=>Array.from({length:p},(P,_)=>{let I=_/(p-1);return M?y+(g-y)*I:g+(y-g)*I});g>=r-1e-9&&c[b+1]<=t-r+1e-9?h.push(k([...E(!1).map(M=>[M,f(M)]),...E(!0).map(M=>[M,d(M)])],S),k([...E(!1).map(M=>[M,e-d(M)]),...E(!0).map(M=>[M,e-f(M)])],S)):h.push(k([...E(!1).map(M=>[M,f(M)]),...E(!0).map(M=>[M,e-f(M)])],S))}return h}var Qr=t=>{let{size:e,gap:n,background:r,frame:a,fitLabel:u}=t,l=a.color||tn.from,o=a.secondaryColor||tn.to,i=e*.05,s=e+2*(i+n),c=t.text?e*.18:0,m=e+(t.text?n+c:2*n),p=m+2*i,f=e*.1;return{width:s,height:p,qrX:i+n,qrY:i+n,qrSize:e,shapes:[w(i,i,s-2*i,m,f-i,r),...Gr(s,p,f,i,l,o)],label:u(t.text,s/2,i+n+e+c/2,c,s-2*i-2*n,a.textColor||j(l,o,.5)),squareEdges:!1,color:l}},Ur=t=>{let{size:e,gap:n,color:r,background:a,frame:u,fitLabel:l}=t,o=e*.035,i=e*.2,s=e+2*(n+o),c=t.text?e*.2:0,m=s,p=m+c,f=(d,h,b,g)=>[[d,h],[d+b*i,h],[d+b*i,h+g*o],[d+b*o,h+g*o],[d+b*o,h+g*i],[d,h+g*i]];return{width:s,height:p,qrX:o+n,qrY:o+n,qrSize:e,shapes:[w(0,0,s,p,0,a),k(f(0,0,1,1),r),k(f(m,0,-1,1),r),k(f(m,m,-1,-1),r),k(f(0,m,1,-1),r)],label:l(t.text,s/2,m+c*.4,c,s-2*n,u.textColor||r),squareEdges:!1,color:r}},an={"banner-top-bottom":Ir,"speech-bubble-top":wr,"chat-bubble":vr,circle:_r,polaroid:Tr,phone:Nr,ticket:Or,badge:qr,envelope:zr,tag:kr,"menu-card":Dr,sticker:Br,"gradient-border":Qr,focus:Ur};function yt(t,e="#000000"){return t?typeof t=="string"?t:t.type==="solid"?t.color:t.type==="image"?t.underlay||e:(t.type==="linear"||t.type==="radial"||t.type==="angular")&&t.stops[0]?.color||e:e}var ae=class extends Error{issues;constructor(e){super(`Invalid frame spec: ${e.slice(0,5).join("; ")}`),this.name="FrameSpecError",this.issues=e}},sn=new WeakMap;function Yr(t){if(t&&typeof t=="object"){let n=sn.get(t);if(n)return n}if(t==null)throw new ae(['A "custom" frame needs a spec']);let e=Me.safeParse(t);if(!e.success)throw new ae(e.error.issues.map(n=>n.path.length>0?`${n.path.join(".")}: ${n.message}`:n.message));return typeof t=="object"&&sn.set(t,e.data),e.data}function Hr(t){let e=yt(t,tt),n=qt(e);return n&&n.a>=1?e:tt}function Vr(t,e,n){let r=t.color||e.colors.frame,a=t.textColor||e.colors.text||r,u=t.secondaryColor||e.colors.accent||r,l=o=>{switch(o){case"frame":return r;case"text":return a;case"accent":return u;case"background":return n;default:return o}};return o=>typeof o=="string"?l(o):j(l(o.mix[0]),l(o.mix[1]),o.amount)}function cn(t,e,n=0,r=0){let a=Zt(t);return a?ke(a,e,n,r):""}function Xr(t,e,n,r){return`M${x(t-n)} ${x(e)}A${x(n)} ${x(r)} 0 1 1 ${x(t+n)} ${x(e)}A${x(n)} ${x(r)} 0 1 1 ${x(t-n)} ${x(e)}Z`}function jr(t,e){let[n,r,a,u]=[t.x1*e,t.y1*e,t.x2*e,t.y2*e],l=Math.hypot(a-n,u-r),o=t.width*e/2,i=l>0?(a-n)/l:1,s=l>0?(u-r)/l:0,c=-s*o,m=i*o,p=(b,g)=>{let y=[n+i*b,r+s*b],S=[n+i*g,r+s*g];if(t.cap==="round"&&g-b>2*o){let E=[y[0]+i*o,y[1]+s*o],R=[S[0]-i*o,S[1]-s*o];return`M${x(E[0]-c)} ${x(E[1]-m)}L${x(R[0]-c)} ${x(R[1]-m)}A${x(o)} ${x(o)} 0 0 1 ${x(R[0]+c)} ${x(R[1]+m)}L${x(E[0]+c)} ${x(E[1]+m)}A${x(o)} ${x(o)} 0 0 1 ${x(E[0]-c)} ${x(E[1]-m)}Z`}return`M${x(y[0]-c)} ${x(y[1]-m)}L${x(S[0]-c)} ${x(S[1]-m)}L${x(S[0]+c)} ${x(S[1]+m)}L${x(y[0]+c)} ${x(y[1]+m)}Z`};if(!t.dash)return{type:"path",d:p(0,l),fillRule:"nonzero"};let f=t.dash[0]*e,d=f+t.dash[1]*e,h=[];for(let b=0;b+f<=l+1e-6;b+=d)h.push(p(b,b+f));return{type:"path",d:h.join(""),fillRule:"nonzero"}}function Wr(t,e){switch(t.type){case"rect":return{type:"rect",x:t.x*e,y:t.y*e,width:t.width*e,height:t.height*e,radius:(t.radius??0)*e,...t.hole&&{hole:{x:t.hole.x*e,y:t.hole.y*e,width:t.hole.width*e,height:t.hole.height*e,radius:(t.hole.radius??0)*e}}};case"circle":return{type:"path",d:$(t.cx*e,t.cy*e,t.r*e)+(t.hole?$(t.cx*e,t.cy*e,t.hole*e):""),fillRule:t.hole?"evenodd":"nonzero"};case"ellipse":return{type:"path",d:Xr(t.cx*e,t.cy*e,t.rx*e,t.ry*e),fillRule:"nonzero"};case"polygon":return{type:"polygon",points:t.points.map(([n,r])=>[n*e,r*e])};case"path":return{type:"path",d:cn(t.d,e),fillRule:t.fillRule??"nonzero"};case"line":return jr(t,e);default:{let n=Ke(t.icon);return{type:"path",d:cn(n.d,t.size*e/We,t.x*e,t.y*e),fillRule:n.fillRule}}}}function Zr(t){if(t.type==="rect"){let{x:e,y:n,width:r,height:a,radius:u,hole:l}=t;return[...he(e,n,r,a,u,u),...l?he(l.x,l.y,l.width,l.height,l.radius,l.radius):[]]}return t.type==="polygon"?[...t.points.map(([e,n],r)=>r===0?{op:"M",x:e,y:n}:{op:"L",x:e,y:n}),{op:"Z"}]:Kt(t.d)}function Kr(t,e,n){let r=Zr(t),a=Be(r,.2),u=t.type==="rect"?t.hole?"evenodd":"nonzero":t.type==="path"?t.fillRule??"nonzero":"nonzero",l=e.direction==="vertical",o=b=>l?b[1]:b[0],i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(let b of a)for(let g of b)i=Math.min(i,o(g)),s=Math.max(s,o(g));if(!(s>i))return[];let c=e.steps??32,m=n(e.from),p=n(e.to),f=s-i,d=f*.002,h=[];for(let b=0;b<c;b++){let g=i+f*b/c,y=Math.min(s,i+f*(b+1)/c+(b+1<c?d:0)),S=l?{x0:Number.NEGATIVE_INFINITY,x1:Number.POSITIVE_INFINITY,y0:g,y1:y}:{x0:g,x1:y,y0:Number.NEGATIVE_INFINITY,y1:Number.POSITIVE_INFINITY},E=a.map(R=>Ge(R,S)).filter(R=>R.length>2);E.length!==0&&h.push({type:"path",d:Qe(E),fill:j(m,p,(b+.5)/c),fillRule:u})}return h}function Jr(t,e,n){let r=Wr(t,e);return typeof t.fill=="object"&&"gradient"in t.fill?Kr(r,t.fill.gradient,n):[{...r,fill:n(t.fill)}]}function to(t,e){let n=Math.min(t.maxLength??N.maxTextLength,N.maxTextLength),r=t.slot==="primary"?e.text??t.text:t.slot==="secondary"?e.secondaryText??t.text:t.text;return Se(r,n)}function eo(t){return t===void 0||!Number.isFinite(t)?1:Math.min(gt,Math.max(Tt,t))}function no(t,e,n,r){let a=to(t,e);if(!a)return[];let u=eo(e.fontScale),l=r(t.color),o=t.weight==="regular"?{fontWeight:400}:{};if(t.type==="curved"){let{cx:h,cy:b,radius:g,side:y,spread:S=140}=t.curve,E=g*n*(S*Math.PI/180),R=Math.min(t.fontSize*n*u,E/(It(a)+.08*a.length));return ie(a,h*n,b*n,g*n,R,y,l,t.id).map(M=>({...M,...o}))}let i=t.box.x*n,s=t.box.y*n,c=t.box.width*n,m=t.box.height*n,p=(t.fontSize??t.box.height*.52)*n,f=Math.min(p*u,m*xe,c/It(a)),d=t.align??"middle";return[{text:a,x:d==="start"?i:d==="end"?i+c:i+c/2,y:s+m/2+f*.35,fontSize:f,maxWidth:c,color:l,...d!=="middle"&&{align:d},...o,field:t.id}]}function ln(t,e,n){let r=Yr(e.spec),a=t/r.qr.size,u=Hr(n),l=Vr(e,r,u),o=r.shapes.flatMap(f=>Jr(f,a,l)),i=ee(r)*a;o.push({type:"rect",x:r.qr.x*a-i,y:r.qr.y*a-i,width:t+2*i,height:t+2*i,radius:(r.qr.radius??0)*a,fill:u});let s=r.labels.flatMap(f=>no(f,e,a,l)),c=s[0],m=c&&c.rotate===void 0?c:null,p=r.bleed??"none";return{width:r.artboard.width*a,height:r.artboard.height*a,qrX:r.qr.x*a,qrY:r.qr.y*a,qrSize:t,shapes:o,label:m,extraLabels:m?s.slice(1):s,squareEdges:p!=="none",color:l(p==="none"?"frame":p)}}var ro="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",oo=.08,io="#000000",Pe="#FFFFFF";function pn(t){return!!(t?.style&&t.style!=="none")}function ao(t){return(t.text??qe).trim().slice(0,et)}function so(t){return(t.secondaryText??"").trim().slice(0,et)}function co(t){return t===void 0||!Number.isFinite(t)?1:Math.min(gt,Math.max(Tt,t))}function lo(t,e,n,r,a,u,l,o){if(!t)return null;let i=Math.min(r*.52*l,a/It(t));return{text:t,x:e,y:n+i*.35,fontSize:i,maxWidth:a,color:u,field:o}}function fn(t,e,n){if(e.style===ye)return ln(t,e,n);let r=e.color||io,a=yt(n,tt),u=ao(e),l=t*oo,o=t*.04,i=t*.22,s=t+2*(o+l),c=s-2*o,m=c-2*l,p=o+l,f=co(e.fontScale),d=(h,b,g,y,S,E,R="text")=>lo(h,b,g,y,S,E,f,R);if(nn(e.style))return an[e.style]({size:t,frame:e,color:r,background:a,text:u,secondaryText:so(e),gap:l,border:o,band:i,fontScale:f,fitLabel:d});switch(e.style){case"banner-top":{let h=t+2*l;return{width:s,height:i+h+o,qrX:p,qrY:i+l,qrSize:t,shapes:[zt(o,i,c,h,0,a),se(rt(0,0,s,i+h+o,0),rt(o,i,c,h,0),r)],label:d(u,s/2,i/2,i,m,e.textColor||Pe),squareEdges:!0,color:r}}case"border":case"rounded-border":{let h=u?t*.18:0,b=t+(u?l+h:2*l),g=b+2*o,y=e.style==="rounded-border"?t*.1:0,S=Math.max(y-o,0);return{width:s,height:g,qrX:p,qrY:o+l,qrSize:t,shapes:[zt(o,o,c,b,S,a),se(rt(0,0,s,g,y),rt(o,o,c,b,S),r)],label:d(u,s/2,o+l+t+h/2,h,m,e.textColor||r),squareEdges:y===0,color:r}}case"speech-bubble":{let h=t*.07,b=Math.max(h-o,0),g=t*.025,y=t*.08,S=s+g+y;return{width:s,height:S+i,qrX:p,qrY:o+l,qrSize:t,shapes:[zt(o,o,c,c,b,a),se(rt(0,0,s,s,h),rt(o,o,c,c,b),r),{type:"polygon",points:[[s/2-y,S+y/2],[s/2,s+g],[s/2+y,S+y/2]],fill:r},zt(0,S,s,i,i/2,r)],label:d(u,s/2,S+i/2,i,m,e.textColor||Pe),squareEdges:!1,color:r}}default:{let h=t+2*l;return{width:s,height:o+h+i,qrX:p,qrY:o+l,qrSize:t,shapes:[zt(o,o,c,h,0,a),se(rt(0,0,s,o+h+i,0),rt(o,o,c,h,0),r)],label:d(u,s/2,o+h+i/2,i,m,e.textColor||Pe),squareEdges:!0,color:r}}}}function rt(t,e,n,r,a){return{x:t,y:e,width:n,height:r,radius:a}}function zt(t,e,n,r,a,u){return{type:"rect",...rt(t,e,n,r,a),fill:u}}function se(t,e,n){return{type:"rect",...t,fill:n,hole:e}}function uo(t){return[...t.label?[t.label]:[],...t.extraLabels??[]]}function dn(t,e){let n=({x:r,y:a,width:u,height:l,radius:o})=>{let i=Math.min(o,u/2,l/2);t.moveTo(r+i,a),t.arcTo(r+u,a,r+u,a+l,i),t.arcTo(r+u,a+l,r,a+l,i),t.arcTo(r,a+l,r,a,i),t.arcTo(r,a,r+u,a,i),t.closePath()};for(let r of e.shapes)if(!(r.fill==="transparent"||r.fill==="none")){if(t.fillStyle=r.fill,r.type==="path"){typeof Path2D<"u"&&t.fill(new Path2D(r.d),r.fillRule??"nonzero");continue}t.beginPath(),r.type==="polygon"?(r.points.forEach(([a,u],l)=>{l===0?t.moveTo(a,u):t.lineTo(a,u)}),t.closePath(),t.fill()):(n(r),r.hole&&n(r.hole),t.fill("evenodd"))}for(let r of uo(e))t.fillStyle=r.color,t.font=`${r.fontWeight??700} ${r.fontSize}px ${ro}`,t.textAlign=r.align==="start"?"left":r.align==="end"?"right":"center",t.textBaseline="alphabetic",r.rotate?(t.save(),t.translate(r.x,r.y),t.rotate(r.rotate*Math.PI/180),t.fillText(r.text,0,0,r.maxWidth),t.restore()):t.fillText(r.text,r.x,r.y,r.maxWidth)}var mo=.22,po=.14;function fo(t,e){let n=t.w*e,r=t.h*e;return{x:t.x+n,y:t.y+r,w:t.w-2*n,h:t.h-2*r}}function Le(t,e,n){if(t.beginPath(),e==="circle"){t.arc(n.x+n.w/2,n.y+n.h/2,Math.min(n.w,n.h)/2,0,Math.PI*2);return}let r=e==="rounded"?Math.min(n.w,n.h)*mo:0;r>0&&typeof t.roundRect=="function"?t.roundRect(n.x,n.y,n.w,n.h,r):t.rect(n.x,n.y,n.w,n.h)}function hn(t,e){return e?fo(t,po):t}var{QrCode:Ae}=H,ho={"1L":3,"1M":2,"1Q":1,"1H":1,"2L":2,"3L":1};function go(t){let e=t*4+17,n=new Uint8Array(e*e),r=(l,o)=>{l>=0&&o>=0&&l<e&&o<e&&(n[o*e+l]=1)};for(let l=0;l<e;l++)r(6,l),r(l,6);for(let[l,o]of[[3,3],[e-4,3],[3,e-4]])for(let i=-4;i<=4;i++)for(let s=-4;s<=4;s++)r(l+s,o+i);let a=[];if(t>1){let l=Math.floor(t/7)+2,o=t===32?26:Math.ceil((t*4+4)/(l*2-2))*2;a.push(6);for(let i=e-7;a.length<l;i-=o)a.splice(1,0,i)}let u=a.length-1;for(let[l,o]of a.entries())for(let[i,s]of a.entries())if(!(l===0&&i===0||l===0&&i===u||l===u&&i===0))for(let c=-2;c<=2;c++)for(let m=-2;m<=2;m++)r(o+m,s+c);for(let l=0;l<=8;l++)r(8,l),r(l,8);for(let l=0;l<8;l++)r(e-1-l,8),r(8,e-1-l);if(t>=7)for(let l=0;l<18;l++){let o=e-11+l%3,i=Math.floor(l/3);r(o,i),r(i,o)}return n}function bo(t,e){let n=t*4+17,r=ct[e].ordinal,a=Ae.NUM_ERROR_CORRECTION_BLOCKS[r]?.[t]??0,u=Ae.ECC_CODEWORDS_PER_BLOCK[r]?.[t]??0,l=Math.floor(Ae.getNumRawDataModules(t)/8),o=a-l%a,i=Math.floor(l/a),s=Array.from({length:a},(E,R)=>i+(R<o?0:1)),c=[],m=[],p=i-u;for(let E=0;E<=i;E++)for(let R=0;R<a;R++)if(R<o){if(E===p)continue;c.push(R),m.push(E<p?E:E-1)}else c.push(R),m.push(E);if(c.length!==l)throw new Error(`Codeword map: interleave mismatch at version ${t}`);let f=go(t),d=new Int16Array(n*n).fill(-1),h=new Int16Array(n*n).fill(-1),b=new Int8Array(n*n).fill(-1),g=l*8,y=0;for(let E=n-1;E>=1;E-=2){E===6&&(E=5);let R=(E+1&2)===0;for(let M=0;M<n;M++)for(let P=0;P<2;P++){let _=E-P,G=(R?n-1-M:M)*n+_;if(!f[G]&&y<g){let Q=y>>>3;d[G]=c[Q],h[G]=m[Q],b[G]=7-(y&7),y++}}}if(y!==g)throw new Error(`Codeword map: placement mismatch at version ${t}`);let S=ho[`${t}${e}`]??0;return{version:t,level:e,size:n,blocks:a,eccPerBlock:u,blockLengths:s,correctable:Math.floor((u-S)/2),block:d,codeword:h,bit:b}}var yo=8,xt=new Map;function gn(t,e){if(!(Number.isInteger(t)&&t>=1&&t<=40))throw new RangeError(`QR version must be 1\u201340, got ${t}`);let n=`${t}${e}`,r=xt.get(n);if(r)return xt.delete(n),xt.set(n,r),r;let a=bo(t,e);if(xt.size>=yo){let u=xt.keys().next().value;u!==void 0&&xt.delete(u)}return xt.set(n,a),a}function bn(t,e){let n=new Array(t.blocks).fill(0),r=new Set;for(let a of e){let u=t.block[a]??-1;if(u<0)continue;let l=u*4096+t.codeword[a];r.has(l)||(r.add(l),n[u]=n[u]+1)}return n}import{z as L}from"zod";import{z as ot}from"zod";var xo=["logo","halftone"],So=ot.enum(xo),yn={logo:["blend","badge"],halftone:["color","mono"]},Eo=ot.enum([...yn.logo,...yn.halftone]),ce=192,xn=t=>Math.ceil(t/3)*4,Mo=ot.object({width:ot.number().int().min(1).max(ce),height:ot.number().int().min(1).max(ce),data:ot.string().max(xn(ce*ce*4))}).refine(t=>t.data.length===xn(t.width*t.height*4),{message:"Art image data does not match its width and height"}),Sn=ot.object({mode:So,image:Mo,intensity:ot.number().min(0).max(1).optional(),variant:Eo.optional(),matchEyes:ot.boolean().optional()});import{z as F}from"zod";var Ma=F.enum(["solid","linear","radial","angular","image"]),Co=F.object({type:F.literal("solid"),color:F.string()}),$e=F.object({color:F.string(),offset:F.number().min(0).max(100)}),Ro=F.object({type:F.literal("linear"),stops:F.array($e).min(2),angle:F.number().optional().default(0)}),Po=F.object({type:F.literal("radial"),stops:F.array($e).min(2)}),Lo=F.object({type:F.literal("angular"),stops:F.array($e).min(2),angle:F.number().optional().default(0)}),Ao=F.enum(["cover","contain","tile"]),$o=F.enum(["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"]),Fo=F.object({type:F.literal("image"),src:F.string().min(1),fit:Ao.optional().default("cover"),scale:F.number().min(.1).max(4).optional().default(1),position:$o.optional().default("center"),opacity:F.number().min(0).max(1).optional().default(1),underlay:F.string().optional()}),St=F.union([F.string(),Co,Ro,Po,Lo,Fo]);import{z as En}from"zod";var Mn=["square","rounded","circle","message","message-reverse","diya","diya-reverse","rounded-triangle","leaf","drop","plus","cross-rounded","hexagon","octagon","flower","heart","squircle","dots","extra-rounded","leaf-reverse","drop-reverse"],Io=["diamond","star","banner"],Cn=En.enum([...Mn,...Io]),Pa=En.enum(Mn);import{z as Rn}from"zod";var Pn=["square","rounded","gear","circle","diya","extra-rounded","message","pointy","leaf","drop","octagon","bevel","squircle","cushion","shield","petal","leaf-reverse"],wo=["curly"],Ln=Rn.enum([...Pn,...wo]),$a=Rn.enum(Pn);import{z as vo}from"zod";var _o=["circle","circle-large","square","diamond","circle-mixed","pacman","rounded","small-square","vertical-line","horizontal-line","liquid","liquid-horizontal","liquid-vertical","classy","classy-rounded","leaf","plus","hexagon","star","heart","random-dots","mosaic","octagon"],An=vo.enum(_o);var To=["square","rounded","circle"],$n=L.enum(To),No=L.object({src:L.string(),height:L.number(),width:L.number(),excavate:L.boolean(),x:L.number().optional(),y:L.number().optional(),padding:L.number().min(0).optional(),shape:$n.optional(),plate:L.string().optional()}),Oo=.1,qo=.3;var zo=2,ka=L.object({size:L.number().min(Oo).max(qo).optional(),padding:L.number().min(0).max(zo).optional(),x:L.number().min(0).max(1).optional(),y:L.number().min(0).max(1).optional(),shape:$n.optional(),plate:L.string().optional()}),ko=L.enum(["L","M","Q","H"]),Do=.5,Bo=1,Fn=.07,Go=["square","circle","heart"],Qo=L.enum(Go),In=3,Et=64,kt=8,wn=.42,Uo=L.object({type:L.literal("silhouette"),width:L.number().int().min(kt).max(Et),height:L.number().int().min(kt).max(Et),cells:L.string().max(Et*Et).regex(/^[01]*$/).describe('Row by row, "1" inside the shape and "0" outside: width \xD7 height characters')}).refine(t=>t.cells.length===t.width*t.height,{message:"Silhouette cells do not match its width and height"}),Yo=L.union([Qo,Uo]);var Fe=L.object({outer:St.optional(),inner:St.optional()}),Ho=L.object({topLeft:Fe.optional(),topRight:Fe.optional(),bottomLeft:Fe.optional()}),Da=L.object({value:L.string(),size:L.number().optional(),level:ko.optional(),bgColor:St.optional(),fgColor:St.optional(),eyeColor:St.optional(),dotColor:St.optional(),bodyPattern:An.optional(),cornerEyePattern:Ln.optional(),cornerEyeDotPattern:Cn.optional(),margin:L.number().optional(),imageSettings:No.optional(),isOGContext:L.boolean().optional(),templateId:L.string().optional(),customProps:L.record(L.string(),L.any()).optional(),frame:Xe.optional(),art:Sn.optional(),eyeColors:Ho.optional(),moduleScale:L.number().min(Do).max(Bo).optional(),autoLevel:L.boolean().optional(),shape:Yo.optional()});var Vo={2:6,3:12};function vn(t){let e=[t.start],n=t.start;for(let r of t.segments){let a=r.at(-1);if(r.length===1)e.push(a);else{let u=Vo[r.length];for(let l=1;l<=u;l++){let o=l/u,i=1-o;if(r.length===2){let[s]=r;e.push([i*i*n[0]+2*i*o*s[0]+o*o*a[0],i*i*n[1]+2*i*o*s[1]+o*o*a[1]])}else{let[s,c]=r;e.push([i*i*i*n[0]+3*i*i*o*s[0]+3*i*o*o*c[0]+o*o*o*a[0],i*i*i*n[1]+3*i*i*o*s[1]+3*i*o*o*c[1]+o*o*o*a[1]])}}}n=a}return e}function Tn(t,e){let n=[];for(let r of t)for(let a=0;a<r.length;a++){let[u,l]=r[a],[o,i]=r[(a+1)%r.length];l<=e!=i<=e&&n.push(u+(e-l)/(i-l)*(o-u))}return n.sort((r,a)=>r-a)}function Nn(t,e){let n=0;for(let r of t)if(r<e)n++;else break;return n%2===1}function Xo(t,e,n){return Nn(Tn(t,n),e)}function On(t){let e=new Map;return(n,r)=>{let a=e.get(r);return a||(a=Tn(t,r),e.set(r,a)),Nn(a,n)}}function jo(t,e,n,r){let a=n[0]-t,u=n[1]-e,l=r[0]-n[0],o=r[1]-n[1],i=c=>Math.max(Math.abs(a+c*l),Math.abs(u+c*o)),s=Math.min(i(0),i(1));for(let[c,m]of[[u-a,l-o],[-(a+u),l+o]])if(m!==0){let p=c/m;p>0&&p<1&&(s=Math.min(s,i(p)))}return s}function Wo(t,e,n){if(!Xo(t,e,n))return 0;let r=Number.POSITIVE_INFINITY;for(let a of t)for(let u=0;u<a.length;u++)r=Math.min(r,jo(e,n,a[u],a[(u+1)%a.length]));return Number.isFinite(r)?r:0}function Zo(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY;for(let u of t)for(let[l,o]of u)e=Math.min(e,l),n=Math.min(n,o),r=Math.max(r,l),a=Math.max(a,o);return{x0:e,y0:n,x1:r,y1:a}}function qn(t){let e=t.map(vn),n=Zo(e),r=n.x1-n.x0,a=n.y1-n.y0;if(!(r>0&&a>0))return null;let u=(d,h)=>{let b=Math.max(d-n.x0,n.x1-d,h-n.y0,n.y1-h);return b>0?Wo(e,d,h)/(2*b):0},l={cx:n.x0+r/2,cy:n.y0+a/2,value:0};l.value=u(l.cx,l.cy);let o=32;for(let d=1;d<o;d++)for(let h=1;h<o;h++){let b=n.x0+r*h/o,g=n.y0+a*d/o,y=u(b,g);y>l.value&&(l={cx:b,cy:g,value:y})}let i=r/o,s=a/o;for(let d=0;d<6;d++){let h=l;for(let b=-2;b<=2;b++)for(let g=-2;g<=2;g++){let y=h.cx+i*g/2,S=h.cy+s*b/2,E=u(y,S);E>l.value&&(l={cx:y,cy:S,value:E})}i/=2,s/=2}if(l.value<=0)return null;let m=.5/Math.max(l.cx-n.x0,n.x1-l.cx,l.cy-n.y0,n.y1-l.cy),p=([d,h])=>[.5+(d-l.cx)*m,.5+(h-l.cy)*m],f=t.map(d=>({start:p(d.start),segments:d.segments.map(h=>h.map(p))}));return{rings:f,polygons:f.map(vn),half:l.value}}function zn(t,e){let n=([a,u])=>`${x(a*e)} ${x(u*e)}`,r="";for(let a of t.rings){r+=`M${n(a.start)}`;for(let u of a.segments){let l=u.length===1?"L":u.length===2?"Q":"C";r+=l+u.map(n).join(" ")}r+="Z"}return r}var Ko={start:[0,-.58],segments:[[[.2,-.92],[1,-.97],[1,-.3]],[[1,.3],[.62,.6],[0,.92]],[[-.62,.6],[-1,.3],[-1,-.3]],[[-1,-.97],[-.2,-.92],[0,-.58]]]},_n;function kn(){return _n??=qn([Ko]),_n}function Jo(t){let{width:e,height:n,cells:r}=t;return Number.isInteger(e)&&Number.isInteger(n)&&e>=kt&&n>=kt&&e<=Et&&n<=Et&&typeof r=="string"&&r.length===e*n&&/^[01]*$/.test(r)?(a,u)=>a>=0&&u>=0&&a<e&&u<n&&r[u*e+a]==="1":null}var it=([t,e])=>`${t},${e}`;function ti(t,e,n){let r=(i,s)=>t(i-1,s-1),a=new Map,u=(i,s)=>{for(let[c,m]of[[i,s],[s,i]]){let p=a.get(it(c))??[];p.push(m),a.set(it(c),p)}};for(let i=0;i<=n;i++)for(let s=0;s<=e;s++){let c=r(s,i),m=r(s+1,i),p=r(s+1,i+1),f=r(s,i+1),d=[s,i-.5],h=[s+.5,i],b=[s,i+.5],g=[s-.5,i];switch((c?8:0)+(m?4:0)+(p?2:0)+(f?1:0)){case 1:case 14:u(g,b);break;case 2:case 13:u(b,h);break;case 3:case 12:u(g,h);break;case 4:case 11:u(d,h);break;case 6:case 9:u(d,b);break;case 7:case 8:u(g,d);break;case 5:u(d,h),u(g,b);break;case 10:u(g,d),u(b,h);break;default:break}}let l=[],o=new Set;for(let[i,s]of a){if(o.has(i)||s.length===0)continue;let[c,m]=i.split(",").map(Number),p=[[c,m]];o.add(i);let f=[c,m],d=s[0];for(;!o.has(it(d));){o.add(it(d)),p.push(d);let h=ei(a.get(it(d))??[],f,o);if(!h)break;f=d,d=h}p.length>=3&&l.push(ni(p))}return l}function ei(t,e,n){let r=it(e);return t.find(a=>it(a)!==r&&!n.has(it(a)))??t.find(a=>it(a)!==r)}function ni(t){let e=[];for(let n=0;n<t.length;n++){let r=t[(n-1+t.length)%t.length],a=t[n],u=t[(n+1)%t.length],l=(a[0]-r[0])*(u[1]-a[1])-(a[1]-r[1])*(u[0]-a[0]);Math.abs(l)>1e-9&&e.push(a)}return e.length>=3?e:t}function ri(t){let e=(u,l)=>[(u[0]+l[0])/2,(u[1]+l[1])/2],n=t.length,r=e(t[n-1],t[0]),a=t.map((u,l)=>[u,e(u,t[(l+1)%n])]);return{start:r,segments:a}}var Dt=new Map;function Dn(t){let e=`${t.width}x${t.height}:${t.cells}`,n=Dt.get(e);if(n)return n;let r=Jo(t),a;if(!r)a={outline:null,problem:"invalid"};else if(t.cells.includes("1")){let u=ti(r,t.width,t.height),l=u.length>0?qn(u.map(ri)):null;a=l&&2*l.half>=wn?{outline:l,problem:null}:{outline:null,problem:l?"thin":"empty"}}else a={outline:null,problem:"empty"};return Dt.size>16&&Dt.delete(Dt.keys().next().value),Dt.set(e,a),a}var oi=1,Bn=.5,Gn=.5,ii=.5;function le(t){return Math.max(t,In)}function Ie(t){return t==="heart"?kn():typeof t=="object"&&t?.type==="silhouette"?Dn(t).outline:null}function pt(t,e,n){if(n==="circle"){let l=le(e),o=(t/2+l)*Math.SQRT2+oi;return Math.ceil(o-t/2)}let r=Ie(n);if(!r)return e;let a=le(e),u=(t+2*(a+ii))/(2*r.half);return Math.ceil((u-t)/2-1e-9)}function Qn(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function ai(t,e,n){let r=pt(e,n,"circle"),a=le(n),u=e+2*r,l=u/2,o=l-Bn-.5,i=Qn(Number.parseInt(Ce(t),36)||1),s=r-a,c=r+e+a;return Array.from({length:u},(m,p)=>Array.from({length:u},(f,d)=>{let h=i()<Gn;return d>=s&&d<c&&p>=s&&p<c?!1:h&&Math.hypot(d+.5-l,p+.5-l)<=o}))}var si=Array.from({length:8},(t,e)=>{let n=e*Math.PI/4;return[Math.cos(n),Math.sin(n)]});function we(t,e,n,r){if(r==="circle")return ai(t,e,n);let a=Ie(r);if(!a)return null;let u=pt(e,n,r),l=le(n),o=e+2*u,i=On(a.polygons),s=.5+Bn,c=(d,h)=>{let b=d+.5,g=h+.5;return i(b/o,g/o)?si.every(([y,S])=>i((b+y*s)/o,(g+S*s)/o)):!1},m=Qn(Number.parseInt(Ce(t),36)||1),p=u-l,f=u+e+l;return Array.from({length:o},(d,h)=>Array.from({length:o},(b,g)=>{let y=m()<Gn;return g>=p&&g<f&&h>=p&&h<f?!1:y&&c(g,h)}))}function ve(t,e){if(t==="circle")return{circle:e/2};let n=Ie(t);return n?{path:zn(n,e)}:null}function Un(t,e){return t.slice().map((n,r)=>r<e.y||r>=e.y+e.h?n:n.map((a,u)=>u<e.x||u>=e.x+e.w?a:!1))}function _e(t,e=0){let n=[];return t.forEach((r,a)=>{let u=null;r.forEach((l,o)=>{if(!l&&u!==null){n.push(O`M${u+e} ${a+e}h${o-u}v1H${u+e}z`),u=null;return}if(o===r.length-1){if(!l)return;u===null?n.push(O`M${o+e},${a+e} h1v1H${o+e}z`):n.push(O`M${u+e},${a+e} h${o+1-u}v1H${u+e}z`);return}l&&u===null&&(u=o)})}),n.join("")}function Bt(t,e,n,r){if(r==null)return null;let a=t.length,u=Math.floor(e*jt),l=(a+2*n)/e,o=(r.width||u)*l,i=(r.height||u)*l,s=r.x==null?a/2-o/2:r.x*l,c=r.y==null?a/2-i/2:r.y*l,m=null;if(r.excavate){let p=Math.max(0,r.padding??0)*l,f=Math.floor(s-p),d=Math.floor(c-p),h=Math.ceil(o+s+p-f),b=Math.ceil(i+c+p-d);m={x:f,y:d,w:h,h:b}}return{x:s,y:c,h:i,w:o,excavation:m}}function ue(t){let e=t.level??At,{imageSettings:n}=t,r=t.isOGContext&&n?.excavate&&(e==="L"||e==="M")?"Q":e;if(t.autoLevel&&n&&r!=="H"){let a=H.QrCode.encodeText(t.value,ct[r]).getModules(),u=Bt(a,t.size??Ht,pt(a.length,t.margin??Xt,t.shape),n);u&&(u.excavation?u.excavation.w*u.excavation.h:u.w*u.h)/(a.length*a.length)>Fn&&(r="H")}return r}var Te=(()=>{try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})();var ci=.6,li=["L","M","Q","H"];function ui(t){let e=H.QrCode.encodeText(t.value,ct[t.level]),n=li[e.errorCorrectionLevel.ordinal]??t.level;return{code:t,cells:e.getModules(),layoutMargin:pt(e.size,t.margin,t.shape),map:gn(e.version,n),level:n,version:e.version}}function mi(t,e){let{cells:n,map:r}=t,a=n.length,u=Bt(n,t.code.size,t.layoutMargin,e);if(!u)return null;let l=u.excavation??{x:Math.floor(u.x),y:Math.floor(u.y),w:Math.ceil(u.x+u.w)-Math.floor(u.x),h:Math.ceil(u.y+u.h)-Math.floor(u.y)},o=[];for(let s=Math.max(0,l.y);s<Math.min(a,l.y+l.h);s++)for(let c=Math.max(0,l.x);c<Math.min(a,l.x+l.w);c++)o.push(s*a+c);let i=bn(r,o);return{worst:Math.max(0,...i),correctable:r.correctable,budget:Math.floor(r.correctable*ci),level:t.level,version:t.version}}var pi=t=>!t||t.worst<=t.budget;function fi(t,e,n,r){let a=e.map(o=>ui({...t,level:o})),u=o=>{let i=r(o);return a.every(s=>pi(mi(s,i)))};if(u(n))return n;let l=t.size*.005;for(let o=n-l;o>0;o-=l)if(u(o))return o;return 0}function Yn(t,e){if(!e)return;let n=Math.floor(t.size*jt),r=e.width||n,a=e.height||n,u=p=>{if(p===r)return e;let f=a*p/r;return{...e,width:p,height:f,...e.x!=null&&{x:e.x+(r-p)/2},...e.y!=null&&{y:e.y+(a-f)/2}}},l=t.level??At,o={value:t.value,size:t.size,margin:t.margin,shape:t.shape},i=p=>ue({...t,level:l,imageSettings:p}),s=p=>{let f=fi(o,[p],r,u);return f>0?u(f):void 0},c=i(e);if(c===l)return s(l);let m=s(c);return m&&i(m)===c?m:s(l)}import{Fragment as gi,jsx as Vn,jsxs as bi}from"react/jsx-runtime";function xs(t){let{value:e,size:n=Ht,level:r=At,bgColor:a=tt,fgColor:u=Vt,margin:l=Xt,style:o,imageSettings:i,eyeColor:s,dotColor:c,bodyPattern:m,cornerEyePattern:p,cornerEyeDotPattern:f,isOGContext:d,templateId:h,customTemplate:b,customProps:g,frame:y,art:S,eyeColors:E,moduleScale:R,frameLabelMarkers:M,partMarkers:P,autoLevel:_,shape:I,...G}=t,Q=Yn({value:e,size:n,margin:l,level:r,shape:I,autoLevel:_},i),Z=ue({value:e,size:n,level:r,margin:l,imageSettings:Q,autoLevel:_,shape:I}),K=Q?.src,U=pn(y)?fn(n,y,a):null,at=U?.width??n,ft=U?.height??n,Mt=Hn(null),Y=Hn(null),[X,W]=hi(!1);di(()=>{if(Mt.current!=null){let wt=Mt.current,v=wt.getContext("2d");if(!v)return;let J=H.QrCode.encodeText(e,ct[Z]).getModules(),st=pt(J.length,l,I),me=we(e,J.length,l,I),Rt=J.length+st*2,dt=Bt(J,n,st,Q),Qt=Y.current,Ne=dt!=null&&Qt?.complete&&Qt.naturalHeight!==0&&Qt.naturalWidth!==0;Ne&&dt.excavation!=null&&(J=Un(J,dt.excavation));let Ut=window.devicePixelRatio||1;wt.width=at*Ut,wt.height=ft*Ut,v.scale(Ut,Ut),U&&(dn(v,U),v.translate(U.qrX,U.qrY));let Oe=n/Rt;v.scale(Oe,Oe),v.fillStyle=yt(a,tt);let vt=ve(I,Rt);if(vt&&"circle"in vt?(v.beginPath(),v.arc(Rt/2,Rt/2,vt.circle,0,2*Math.PI),v.fill()):vt&&Te?v.fill(new Path2D(vt.path),"evenodd"):v.fillRect(0,0,Rt,Rt),v.fillStyle=yt(u,Vt),Te)v.fill(new Path2D(_e(J,st))),me&&v.fill(new Path2D(_e(me,0)));else for(let[Yt,Pt]of[[J,st],[me??[],0]])Yt.forEach((_t,ht)=>{_t.forEach((Xn,jn)=>{Xn&&v.fillRect(jn+Pt,ht+Pt,1,1)})});if(Ne){let Yt={x:dt.x+st,y:dt.y+st,w:dt.w,h:dt.h},Pt=Q?.shape??"square",_t=Q?.plate,ht=hn(Yt,_t);v.save(),_t&&(Le(v,Pt,Yt),v.fillStyle=_t,v.fill()),Pt!=="square"&&(Le(v,Pt,ht),v.clip()),v.drawImage(Qt,ht.x,ht.y,ht.w,ht.h),v.restore()}}});let Ct={height:ft,width:at,...o},Gt=null;return K!=null&&(Gt=Vn("img",{alt:"QR code",onLoad:()=>{W(!0)},ref:Y,src:K,style:{display:"none"}},K)),bi(gi,{children:[Vn("canvas",{height:ft,ref:Mt,style:Ct,width:at,...G}),Gt]})}export{xs as QRCodeCanvas};
|
|
2
2
|
/**
|
|
3
3
|
* @license QR Code generator library (TypeScript)
|
|
4
4
|
* Copyright (c) Project Nayuki.
|