qrdx 0.0.51 → 0.0.52
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 +102 -6
- package/dist/angular.js +252 -0
- package/dist/angular.js.map +1 -0
- package/dist/angular.mjs +226 -0
- package/dist/angular.mjs.map +1 -0
- package/dist/core.js +7 -7
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +7 -7
- package/dist/core.mjs.map +1 -1
- package/dist/element-define.browser.mjs +2 -0
- package/dist/element-define.browser.mjs.map +1 -0
- package/dist/element-define.js +2 -0
- package/dist/element-define.js.map +1 -0
- package/dist/element-define.mjs +2 -0
- package/dist/element-define.mjs.map +1 -0
- package/dist/element.browser.mjs +91 -0
- package/dist/element.browser.mjs.map +1 -0
- package/dist/element.js +2 -0
- package/dist/element.js.map +1 -0
- package/dist/element.mjs +2 -0
- package/dist/element.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/preact.js +2 -0
- package/dist/preact.js.map +1 -0
- package/dist/preact.mjs +2 -0
- package/dist/preact.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/solid.js +2 -0
- package/dist/solid.js.map +1 -0
- package/dist/solid.mjs +2 -0
- package/dist/solid.mjs.map +1 -0
- package/dist/src/angular.d.ts +94 -0
- package/dist/src/element-define.d.ts +3 -0
- package/dist/src/element-define.d.ts.map +1 -0
- package/dist/src/element.d.ts +150 -0
- package/dist/src/element.d.ts.map +1 -0
- package/dist/src/engine.d.ts +3 -3
- package/dist/src/engine.d.ts.map +1 -1
- package/dist/src/frame-spec.d.ts +22 -4
- package/dist/src/frame-spec.d.ts.map +1 -1
- package/dist/src/frame-text.d.ts +19 -0
- package/dist/src/frame-text.d.ts.map +1 -0
- package/dist/src/frame.d.ts +12 -7
- package/dist/src/frame.d.ts.map +1 -1
- package/dist/src/frames/builtin.d.ts +53 -5
- package/dist/src/frames/builtin.d.ts.map +1 -1
- package/dist/src/frames/catalogue/all.d.ts.map +1 -1
- package/dist/src/frames/catalogue/automotive.d.ts.map +1 -1
- package/dist/src/frames/catalogue/counts.d.ts +6 -6
- package/dist/src/frames/catalogue/counts.d.ts.map +1 -1
- package/dist/src/frames/catalogue/events.d.ts.map +1 -1
- package/dist/src/frames/catalogue/holidays.d.ts.map +1 -1
- package/dist/src/frames/catalogue/index.d.ts.map +1 -1
- package/dist/src/frames/catalogue/places.d.ts.map +1 -1
- package/dist/src/frames/catalogue/seasons.d.ts.map +1 -1
- package/dist/src/frames/catalogue/tags.d.ts.map +1 -1
- package/dist/src/preact.d.ts +29 -0
- package/dist/src/preact.d.ts.map +1 -0
- package/dist/src/scan-score.d.ts +4 -3
- package/dist/src/scan-score.d.ts.map +1 -1
- package/dist/src/solid.d.ts +21 -0
- package/dist/src/solid.d.ts.map +1 -0
- package/dist/src/template/dot-ring-layout.d.ts +44 -0
- package/dist/src/template/dot-ring-layout.d.ts.map +1 -0
- package/dist/src/template/dot-ring.d.ts +41 -0
- package/dist/src/template/dot-ring.d.ts.map +1 -0
- package/dist/src/template/index.d.ts +1 -0
- package/dist/src/template/index.d.ts.map +1 -1
- package/dist/src/template-placement.d.ts +8 -0
- package/dist/src/template-placement.d.ts.map +1 -0
- package/dist/src/templates.d.ts.map +1 -1
- package/dist/types/frame-spec.d.ts +149 -14
- package/dist/types/frame-spec.d.ts.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +2 -2
- package/dist/types/index.mjs.map +1 -1
- package/dist/types/qr.d.ts +26 -3
- package/dist/types/qr.d.ts.map +1 -1
- package/dist/vanilla.browser.mjs +30 -30
- package/dist/vanilla.browser.mjs.map +1 -1
- package/package.json +81 -5
- package/src/angular.ts +218 -0
- package/src/element-define.ts +9 -0
- package/src/element.ts +608 -0
- package/src/engine.ts +13 -2
- package/src/frame-spec.ts +314 -54
- package/src/frame-text.ts +111 -0
- package/src/frame.tsx +17 -280
- package/src/frames/builtin/badge.json +108 -0
- package/src/frames/builtin/banner-bottom.json +2 -1
- package/src/frames/builtin/banner-top-bottom.json +72 -0
- package/src/frames/builtin/banner-top.json +59 -0
- package/src/frames/builtin/border.json +62 -0
- package/src/frames/builtin/chat-bubble.json +54 -0
- package/src/frames/builtin/circle.json +2 -1
- package/src/frames/builtin/envelope.json +81 -0
- package/src/frames/builtin/focus.json +88 -0
- package/src/frames/builtin/gradient-border.json +76 -0
- package/src/frames/builtin/menu-card.json +108 -0
- package/src/frames/builtin/phone.json +75 -0
- package/src/frames/builtin/polaroid.json +56 -0
- package/src/frames/builtin/rounded-border.json +8 -4
- package/src/frames/builtin/speech-bubble-top.json +76 -0
- package/src/frames/builtin/speech-bubble.json +76 -0
- package/src/frames/builtin/sticker.json +78 -0
- package/src/frames/builtin/tag.json +55 -0
- package/src/frames/builtin.ts +181 -12
- package/src/frames/catalogue/all.ts +584 -0
- package/src/frames/catalogue/automotive.ts +2 -0
- package/src/frames/catalogue/counts.ts +6 -6
- package/src/frames/catalogue/events.ts +90 -0
- package/src/frames/catalogue/holidays.ts +336 -0
- package/src/frames/catalogue/index.ts +2733 -0
- package/src/frames/catalogue/places.ts +92 -0
- package/src/frames/catalogue/seasons.ts +64 -0
- package/src/frames/catalogue/tags.ts +384 -0
- package/src/frames/official/africa-day.json +110 -0
- package/src/frames/official/aquarium-feeding.json +113 -0
- package/src/frames/official/autumn-apple-picking.json +81 -0
- package/src/frames/official/autumn-mushroom.json +72 -0
- package/src/frames/official/autumn-pumpkin-patch.json +83 -0
- package/src/frames/official/avurudu-pot.json +87 -0
- package/src/frames/official/beach-conditions.json +113 -0
- package/src/frames/official/beach-info-sticker.json +81 -0
- package/src/frames/official/beach-lifeguard.json +71 -0
- package/src/frames/official/blood-donor-drop.json +87 -0
- package/src/frames/official/blood-donor-sticker.json +94 -0
- package/src/frames/official/book-day-arch.json +71 -0
- package/src/frames/official/book-day-list.json +114 -0
- package/src/frames/official/camp-check-in.json +74 -0
- package/src/frames/official/camp-fire-rules.json +114 -0
- package/src/frames/official/camp-map.json +85 -0
- package/src/frames/official/carnival-mask.json +76 -0
- package/src/frames/official/carnival-pass.json +85 -0
- package/src/frames/official/carnival-plume.json +71 -0
- package/src/frames/official/childrens-day-carp.json +114 -0
- package/src/frames/official/childrens-day-sticker.json +88 -0
- package/src/frames/official/chuseok-gift-tag.json +59 -0
- package/src/frames/official/chuseok-moon.json +99 -0
- package/src/frames/official/chuseok-songpyeon.json +114 -0
- package/src/frames/official/cowork-desk.json +82 -0
- package/src/frames/official/cowork-meeting-room.json +107 -0
- package/src/frames/official/dragon-boat-race.json +83 -0
- package/src/frames/official/dragon-boat-ticket.json +98 -0
- package/src/frames/official/dragon-boat-zongzi.json +81 -0
- package/src/frames/official/durga-puja-lotus.json +114 -0
- package/src/frames/official/dussehra-seal.json +187 -0
- package/src/frames/official/earth-day-globe.json +77 -0
- package/src/frames/official/earth-day-pledge.json +66 -0
- package/src/frames/official/earth-day-recycle.json +109 -0
- package/src/frames/official/enkutatash-daisy.json +87 -0
- package/src/frames/official/enkutatash-seal.json +179 -0
- package/src/frames/official/environment-day.json +83 -0
- package/src/frames/official/event-anniversary.json +107 -0
- package/src/frames/official/event-awards.json +93 -0
- package/src/frames/official/event-baby-gifts.json +113 -0
- package/src/frames/official/event-baby-shower.json +70 -0
- package/src/frames/official/event-birth-announcement.json +71 -0
- package/src/frames/official/event-book-fair.json +142 -0
- package/src/frames/official/event-booth.json +98 -0
- package/src/frames/official/event-craft-fair.json +96 -0
- package/src/frames/official/event-cupcake.json +81 -0
- package/src/frames/official/event-engagement.json +116 -0
- package/src/frames/official/event-film-festival.json +92 -0
- package/src/frames/official/event-food-festival.json +108 -0
- package/src/frames/official/event-fun-run.json +107 -0
- package/src/frames/official/event-gala.json +121 -0
- package/src/frames/official/event-game-night.json +97 -0
- package/src/frames/official/event-grad-diploma.json +126 -0
- package/src/frames/official/event-grad-party.json +108 -0
- package/src/frames/official/event-grad-seal.json +186 -0
- package/src/frames/official/event-grad-stream.json +94 -0
- package/src/frames/official/event-guest-book.json +121 -0
- package/src/frames/official/event-hackathon.json +82 -0
- package/src/frames/official/event-keynote.json +74 -0
- package/src/frames/official/event-match-lineup.json +66 -0
- package/src/frames/official/event-meetup.json +86 -0
- package/src/frames/official/event-memorial.json +124 -0
- package/src/frames/official/event-milestone.json +168 -0
- package/src/frames/official/event-night-market.json +88 -0
- package/src/frames/official/event-open-mic.json +94 -0
- package/src/frames/official/event-party-hat.json +74 -0
- package/src/frames/official/event-prom.json +82 -0
- package/src/frames/official/event-quince.json +70 -0
- package/src/frames/official/event-retirement.json +92 -0
- package/src/frames/official/event-reunion.json +98 -0
- package/src/frames/official/event-runner-tracker.json +101 -0
- package/src/frames/official/event-season-ticket.json +89 -0
- package/src/frames/official/event-session-feedback.json +89 -0
- package/src/frames/official/event-setlist.json +70 -0
- package/src/frames/official/event-short-films.json +113 -0
- package/src/frames/official/event-slides.json +85 -0
- package/src/frames/official/event-speaker-qa.json +112 -0
- package/src/frames/official/event-talent-show.json +130 -0
- package/src/frames/official/event-tour-merch.json +63 -0
- package/src/frames/official/event-tournament.json +98 -0
- package/src/frames/official/event-trivia.json +79 -0
- package/src/frames/official/event-workshop.json +127 -0
- package/src/frames/official/festa-della-repubblica.json +100 -0
- package/src/frames/official/festa-junina-bonfire.json +81 -0
- package/src/frames/official/festa-junina-corn.json +72 -0
- package/src/frames/official/festa-junina-flags.json +110 -0
- package/src/frames/official/fiestas-patrias-chile.json +76 -0
- package/src/frames/official/food-day-wheat.json +109 -0
- package/src/frames/official/freedom-day-south-africa.json +109 -0
- package/src/frames/official/ganesh-marigold.json +71 -0
- package/src/frames/official/ganesh-modak.json +81 -0
- package/src/frames/official/ganesh-pandal.json +109 -0
- package/src/frames/official/garden-plant-label.json +98 -0
- package/src/frames/official/german-unity-day.json +100 -0
- package/src/frames/official/green-ribbon.json +123 -0
- package/src/frames/official/gudi-padwa.json +81 -0
- package/src/frames/official/hanami-arch.json +71 -0
- package/src/frames/official/hanami-picnic.json +90 -0
- package/src/frames/official/hanami-sakura.json +81 -0
- package/src/frames/official/hari-raya-haji.json +122 -0
- package/src/frames/official/hari-raya-ketupat.json +81 -0
- package/src/frames/official/hari-raya-open-house.json +114 -0
- package/src/frames/official/hari-raya-pelita.json +77 -0
- package/src/frames/official/harvest-basket.json +87 -0
- package/src/frames/official/harvest-corn.json +115 -0
- package/src/frames/official/harvest-hay.json +89 -0
- package/src/frames/official/harvest-market.json +109 -0
- package/src/frames/official/hijri-new-year-stamp.json +77 -0
- package/src/frames/official/hijri-new-year.json +122 -0
- package/src/frames/official/historic-marker.json +176 -0
- package/src/frames/official/hostel-check-in.json +113 -0
- package/src/frames/official/hostel-house-rules.json +136 -0
- package/src/frames/official/hostel-local-tips.json +86 -0
- package/src/frames/official/independence-argentina.json +105 -0
- package/src/frames/official/independence-bangladesh.json +64 -0
- package/src/frames/official/independence-colombia.json +108 -0
- package/src/frames/official/independence-ghana.json +105 -0
- package/src/frames/official/independence-indonesia.json +92 -0
- package/src/frames/official/independence-nigeria.json +100 -0
- package/src/frames/official/independence-pakistan.json +95 -0
- package/src/frames/official/independence-peru.json +100 -0
- package/src/frames/official/independence-poland.json +92 -0
- package/src/frames/official/independence-ukraine.json +92 -0
- package/src/frames/official/inti-raymi-sun.json +183 -0
- package/src/frames/official/jamhuri-day.json +116 -0
- package/src/frames/official/janmashtami-feather.json +77 -0
- package/src/frames/official/janmashtami-flute.json +81 -0
- package/src/frames/official/juneteenth-seal.json +187 -0
- package/src/frames/official/juneteenth-star.json +81 -0
- package/src/frames/official/kindness-day.json +109 -0
- package/src/frames/official/kings-day-crown.json +88 -0
- package/src/frames/official/kwanzaa-bands.json +100 -0
- package/src/frames/official/kwanzaa-harvest.json +77 -0
- package/src/frames/official/kwanzaa-kinara.json +81 -0
- package/src/frames/official/lantern-festival-riddles.json +77 -0
- package/src/frames/official/lantern-festival-tangyuan.json +122 -0
- package/src/frames/official/library-catalog.json +120 -0
- package/src/frames/official/library-ebooks.json +107 -0
- package/src/frames/official/library-hours.json +107 -0
- package/src/frames/official/lohri-bonfire.json +81 -0
- package/src/frames/official/lohri-dhol.json +114 -0
- package/src/frames/official/loy-krathong-float.json +88 -0
- package/src/frames/official/loy-krathong-moon.json +96 -0
- package/src/frames/official/loy-krathong-program.json +128 -0
- package/src/frames/official/mardi-gras-seal.json +183 -0
- package/src/frames/official/marina-welcome.json +172 -0
- package/src/frames/official/maslenitsa-pancakes.json +81 -0
- package/src/frames/official/maslenitsa-sun.json +183 -0
- package/src/frames/official/mid-autumn-gift.json +105 -0
- package/src/frames/official/mid-autumn-lantern-walk.json +96 -0
- package/src/frames/official/mid-autumn-mooncake.json +81 -0
- package/src/frames/official/mid-autumn-rabbit.json +77 -0
- package/src/frames/official/mid-autumn-seal.json +178 -0
- package/src/frames/official/monsoon-boots.json +88 -0
- package/src/frames/official/monsoon-chai.json +82 -0
- package/src/frames/official/monsoon-cloud.json +114 -0
- package/src/frames/official/monsoon-paper-boat.json +71 -0
- package/src/frames/official/monsoon-umbrella.json +81 -0
- package/src/frames/official/muertos-marigold.json +87 -0
- package/src/frames/official/muertos-ofrenda.json +129 -0
- package/src/frames/official/muertos-pan.json +78 -0
- package/src/frames/official/muertos-papel-picado.json +120 -0
- package/src/frames/official/muertos-seal.json +185 -0
- package/src/frames/official/museum-artist-note.json +124 -0
- package/src/frames/official/museum-exhibit-label.json +106 -0
- package/src/frames/official/museum-gallery-map.json +99 -0
- package/src/frames/official/museum-ticket.json +86 -0
- package/src/frames/official/national-day-belgium.json +100 -0
- package/src/frames/official/national-day-singapore.json +120 -0
- package/src/frames/official/navratri-dandiya.json +88 -0
- package/src/frames/official/navratri-garba-pass.json +90 -0
- package/src/frames/official/navratri-lamp.json +72 -0
- package/src/frames/official/nowruz-goldfish.json +71 -0
- package/src/frames/official/nowruz-party.json +90 -0
- package/src/frames/official/nowruz-sabzeh.json +81 -0
- package/src/frames/official/nowruz-seal.json +187 -0
- package/src/frames/official/obon-lantern.json +81 -0
- package/src/frames/official/obon-sign.json +109 -0
- package/src/frames/official/ocean-day-waves.json +114 -0
- package/src/frames/official/onam-boat-race.json +83 -0
- package/src/frames/official/onam-kasavu.json +122 -0
- package/src/frames/official/onam-pookalam.json +175 -0
- package/src/frames/official/onam-sadya.json +114 -0
- package/src/frames/official/orthodox-christmas-candle.json +71 -0
- package/src/frames/official/orthodox-christmas-star.json +76 -0
- package/src/frames/official/orthodox-easter-arch.json +77 -0
- package/src/frames/official/orthodox-easter-pysanka.json +87 -0
- package/src/frames/official/orthodox-easter-seal.json +185 -0
- package/src/frames/official/pancake-day.json +114 -0
- package/src/frames/official/park-bench-walks.json +121 -0
- package/src/frames/official/park-dog-rules.json +88 -0
- package/src/frames/official/park-map.json +92 -0
- package/src/frames/official/park-playground.json +64 -0
- package/src/frames/official/park-report.json +118 -0
- package/src/frames/official/parking-find-car.json +89 -0
- package/src/frames/official/peace-day-dove.json +66 -0
- package/src/frames/official/pink-ribbon-seal.json +180 -0
- package/src/frames/official/pink-ribbon.json +82 -0
- package/src/frames/official/pohela-boishakh-mela.json +116 -0
- package/src/frames/official/pohela-boishakh.json +120 -0
- package/src/frames/official/pongal-offers.json +120 -0
- package/src/frames/official/pongal-pot.json +81 -0
- package/src/frames/official/pongal-sun.json +183 -0
- package/src/frames/official/posadas-candle.json +71 -0
- package/src/frames/official/posadas-pinata.json +114 -0
- package/src/frames/official/pride-flag.json +124 -0
- package/src/frames/official/pride-heart.json +83 -0
- package/src/frames/official/pride-rainbow.json +81 -0
- package/src/frames/official/purim-mask.json +109 -0
- package/src/frames/official/purim-pastry.json +71 -0
- package/src/frames/official/puthandu-sun.json +101 -0
- package/src/frames/official/rakhi-envelope.json +75 -0
- package/src/frames/official/rakhi-gift-tag.json +59 -0
- package/src/frames/official/rakhi-thread.json +114 -0
- package/src/frames/official/ramadan-dates.json +81 -0
- package/src/frames/official/ramadan-suhoor.json +94 -0
- package/src/frames/official/red-ribbon.json +66 -0
- package/src/frames/official/republic-day-india-bands.json +120 -0
- package/src/frames/official/republic-day-india.json +182 -0
- package/src/frames/official/reyes-crown.json +78 -0
- package/src/frames/official/reyes-rosca.json +89 -0
- package/src/frames/official/rosh-hashanah-apple.json +81 -0
- package/src/frames/official/rosh-hashanah-honey.json +71 -0
- package/src/frames/official/rosh-hashanah-shofar.json +128 -0
- package/src/frames/official/sankranti-kite.json +114 -0
- package/src/frames/official/sankranti-sky.json +98 -0
- package/src/frames/official/sankranti-sticker.json +90 -0
- package/src/frames/official/school-backpack.json +81 -0
- package/src/frames/official/school-bus-routes.json +83 -0
- package/src/frames/official/school-lunch-menu.json +81 -0
- package/src/frames/official/school-uniform.json +109 -0
- package/src/frames/official/school-welcome-apple.json +71 -0
- package/src/frames/official/seollal-knot.json +122 -0
- package/src/frames/official/sham-el-nessim.json +81 -0
- package/src/frames/official/shogatsu-kadomatsu.json +81 -0
- package/src/frames/official/songkran-bands.json +123 -0
- package/src/frames/official/songkran-bowl.json +81 -0
- package/src/frames/official/songkran-drop.json +90 -0
- package/src/frames/official/songkran-waves.json +96 -0
- package/src/frames/official/spring-cleaning.json +107 -0
- package/src/frames/official/spring-showers.json +71 -0
- package/src/frames/official/spring-watering-can.json +114 -0
- package/src/frames/official/summer-camp.json +90 -0
- package/src/frames/official/summer-pool.json +95 -0
- package/src/frames/official/summer-reading.json +81 -0
- package/src/frames/official/summer-sunglasses.json +114 -0
- package/src/frames/official/summer-watermelon.json +89 -0
- package/src/frames/official/tabaski.json +114 -0
- package/src/frames/official/tanabata-stars.json +170 -0
- package/src/frames/official/tanabata-wishes.json +114 -0
- package/src/frames/official/teachers-day-apple.json +81 -0
- package/src/frames/official/teachers-day-note.json +109 -0
- package/src/frames/official/tet-apricot.json +114 -0
- package/src/frames/official/tet-banh-chung.json +81 -0
- package/src/frames/official/transit-bike-share.json +94 -0
- package/src/frames/official/transit-bus-arrivals.json +113 -0
- package/src/frames/official/transit-fare.json +97 -0
- package/src/frames/official/transit-ferry.json +88 -0
- package/src/frames/official/transit-next-trains.json +119 -0
- package/src/frames/official/transit-report.json +99 -0
- package/src/frames/official/transit-train-timetable.json +98 -0
- package/src/frames/official/ugadi-leaves.json +66 -0
- package/src/frames/official/vaisakhi-bands.json +120 -0
- package/src/frames/official/vaisakhi-dhol.json +81 -0
- package/src/frames/official/vaisakhi-wheat.json +73 -0
- package/src/frames/official/vesak-candle.json +122 -0
- package/src/frames/official/vesak-lantern.json +114 -0
- package/src/frames/official/vesak-lotus.json +71 -0
- package/src/frames/official/vesak-seal.json +179 -0
- package/src/frames/official/visitor-info.json +78 -0
- package/src/frames/official/visitor-town-map.json +108 -0
- package/src/frames/official/visitor-wildlife.json +70 -0
- package/src/frames/official/water-day-drop.json +81 -0
- package/src/frames/official/wifi-cafe-cup.json +81 -0
- package/src/frames/official/wifi-cowork.json +63 -0
- package/src/frames/official/wifi-hostel-board.json +80 -0
- package/src/frames/official/wifi-library.json +96 -0
- package/src/frames/official/wifi-reception.json +118 -0
- package/src/frames/official/wifi-rental.json +91 -0
- package/src/frames/official/wifi-venue.json +80 -0
- package/src/frames/official/wifi-waiting-room.json +89 -0
- package/src/frames/official/winter-lift-pass.json +90 -0
- package/src/frames/official/winter-sale.json +120 -0
- package/src/frames/official/winter-skating.json +71 -0
- package/src/frames/official/winter-snowman.json +81 -0
- package/src/frames/official/womens-day-mimosa.json +81 -0
- package/src/frames/official/womens-day-seal.json +179 -0
- package/src/frames/official/yalda-poem.json +122 -0
- package/src/frames/official/yalda-pomegranate.json +81 -0
- package/src/frames/official/yalda-watermelon.json +72 -0
- package/src/frames/official/yoga-day-lotus.json +81 -0
- package/src/frames/official/zoo-animal-facts.json +109 -0
- package/src/preact.ts +80 -0
- package/src/scan-score.ts +14 -7
- package/src/solid.ts +75 -0
- package/src/template/dot-ring-layout.ts +230 -0
- package/src/template/dot-ring.tsx +165 -0
- package/src/template/index.ts +1 -0
- package/src/template-placement.ts +149 -0
- package/src/templates.tsx +16 -1
- package/types/frame-spec.ts +214 -10
- package/types/qr.ts +1 -1
- package/dist/src/frame-styles.d.ts +0 -50
- package/dist/src/frame-styles.d.ts.map +0 -1
- package/src/frame-styles.ts +0 -1095
package/dist/qr-code-canvas.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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};
|
|
1
|
+
"use client";import{useEffect as ki,useRef as ar,useState as zi}from"react";var gt;(c=>{class t{constructor(o,a,l,u){this.version=o;this.errorCorrectionLevel=a;if(o<t.MIN_VERSION||o>t.MAX_VERSION)throw new RangeError("Version value out of range");if(u<-1||u>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(l);if(this.drawCodewords(p),u==-1){let f=1e9;for(let y=0;y<8;y++){this.applyMask(y),this.drawFormatBits(y);let h=this.getPenaltyScore();h<f&&(u=y,f=h),this.applyMask(y)}}r(0<=u&&u<=7),this.mask=u,this.applyMask(u),this.drawFormatBits(u),this.isFunction=[]}version;errorCorrectionLevel;static encodeText(o,a){let l=c.QrSegment.makeSegments(o);return t.encodeSegments(l,a)}static encodeBinary(o,a){let l=c.QrSegment.makeBytes(o);return t.encodeSegments([l],a)}static encodeSegments(o,a,l=1,u=40,m=-1,p=!0){if(!(t.MIN_VERSION<=l&&l<=u&&u<=t.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let f,y;for(f=l;;f++){let d=t.getNumDataCodewords(f,a)*8,C=i.getTotalBits(o,f);if(C<=d){y=C;break}if(f>=u)throw new RangeError("Data too long")}for(let d of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])p&&y<=t.getNumDataCodewords(f,d)*8&&(a=d);let h=[];for(let d of o){e(d.mode.modeBits,4,h),e(d.numChars,d.mode.numCharCountBits(f),h);for(let C of d.getData())h.push(C)}r(h.length==y);let g=t.getNumDataCodewords(f,a)*8;r(h.length<=g),e(0,Math.min(4,g-h.length),h),e(0,(8-h.length%8)%8,h),r(h.length%8==0);for(let d=236;h.length<g;d^=253)e(d,8,h);let x=[];for(;x.length*8<h.length;)x.push(0);return h.forEach((d,C)=>x[C>>>3]|=d<<7-(C&7)),new t(f,a,x,m)}size;mask;modules=[];isFunction=[];getModule(o,a){return 0<=o&&o<this.size&&0<=a&&a<this.size&&this.modules[a][o]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let o=this.getAlignmentPatternPositions(),a=o.length;for(let l=0;l<a;l++)for(let u=0;u<a;u++)l==0&&u==0||l==0&&u==a-1||l==a-1&&u==0||this.drawAlignmentPattern(o[l],o[u]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(o){let a=this.errorCorrectionLevel.formatBits<<3|o,l=a;for(let m=0;m<10;m++)l=l<<1^(l>>>9)*1335;let u=(a<<10|l)^21522;r(u>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,n(u,m));this.setFunctionModule(8,7,n(u,6)),this.setFunctionModule(8,8,n(u,7)),this.setFunctionModule(7,8,n(u,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,n(u,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,n(u,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,n(u,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let o=this.version;for(let l=0;l<12;l++)o=o<<1^(o>>>11)*7973;let a=this.version<<12|o;r(a>>>18==0);for(let l=0;l<18;l++){let u=n(a,l),m=this.size-11+l%3,p=Math.floor(l/3);this.setFunctionModule(m,p,u),this.setFunctionModule(p,m,u)}}drawFinderPattern(o,a){for(let l=-4;l<=4;l++)for(let u=-4;u<=4;u++){let m=Math.max(Math.abs(u),Math.abs(l)),p=o+u,f=a+l;0<=p&&p<this.size&&0<=f&&f<this.size&&this.setFunctionModule(p,f,m!=2&&m!=4)}}drawAlignmentPattern(o,a){for(let l=-2;l<=2;l++)for(let u=-2;u<=2;u++)this.setFunctionModule(o+u,a+l,Math.max(Math.abs(u),Math.abs(l))!=1)}setFunctionModule(o,a,l){this.modules[a][o]=l,this.isFunction[a][o]=!0}addEccAndInterleave(o){let a=this.version,l=this.errorCorrectionLevel;if(o.length!=t.getNumDataCodewords(a,l))throw new RangeError("Invalid argument");let u=t.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][a],m=t.ECC_CODEWORDS_PER_BLOCK[l.ordinal][a],p=Math.floor(t.getNumRawDataModules(a)/8),f=u-p%u,y=Math.floor(p/u),h=[],g=t.reedSolomonComputeDivisor(m);for(let d=0,C=0;d<u;d++){let M=o.slice(C,C+y-m+(d<f?0:1));C+=M.length;let F=t.reedSolomonComputeRemainder(M,g);d<f&&M.push(0),h.push(M.concat(F))}let x=[];for(let d=0;d<h[0].length;d++)h.forEach((C,M)=>{(d!=y-m||M>=f)&&x.push(C[d])});return r(x.length==p),x}drawCodewords(o){if(o.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let a=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let u=0;u<this.size;u++)for(let m=0;m<2;m++){let p=l-m,y=(l+1&2)==0?this.size-1-u:u;!this.isFunction[y][p]&&a<o.length*8&&(this.modules[y][p]=n(o[a>>>3],7-(a&7)),a++)}}r(a==o.length*8)}applyMask(o){if(o<0||o>7)throw new RangeError("Mask value out of range");for(let a=0;a<this.size;a++)for(let l=0;l<this.size;l++){let u;switch(o){case 0:u=(l+a)%2==0;break;case 1:u=a%2==0;break;case 2:u=l%3==0;break;case 3:u=(l+a)%3==0;break;case 4:u=(Math.floor(l/3)+Math.floor(a/2))%2==0;break;case 5:u=l*a%2+l*a%3==0;break;case 6:u=(l*a%2+l*a%3)%2==0;break;case 7:u=((l+a)%2+l*a%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[a][l]&&u&&(this.modules[a][l]=!this.modules[a][l])}}getPenaltyScore(){let o=0;for(let m=0;m<this.size;m++){let p=!1,f=0,y=[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,y),p||(o+=this.finderPenaltyCountPatterns(y)*t.PENALTY_N3),p=this.modules[m][h],f=1);o+=this.finderPenaltyTerminateAndCount(p,f,y)*t.PENALTY_N3}for(let m=0;m<this.size;m++){let p=!1,f=0,y=[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,y),p||(o+=this.finderPenaltyCountPatterns(y)*t.PENALTY_N3),p=this.modules[h][m],f=1);o+=this.finderPenaltyTerminateAndCount(p,f,y)*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 a=0;for(let m of this.modules)a=m.reduce((p,f)=>p+(f?1:0),a);let l=this.size*this.size,u=Math.ceil(Math.abs(a*20-l*10)/l)-1;return r(0<=u&&u<=9),o+=u*t.PENALTY_N4,r(0<=o&&o<=2568888),o}getAlignmentPatternPositions(){if(this.version==1)return[];{let o=Math.floor(this.version/7)+2,a=this.version==32?26:Math.ceil((this.version*4+4)/(o*2-2))*2,l=[6];for(let u=this.size-7;l.length<o;u-=a)l.splice(1,0,u);return l}}static getNumRawDataModules(o){if(o<t.MIN_VERSION||o>t.MAX_VERSION)throw new RangeError("Version number out of range");let a=(16*o+128)*o+64;if(o>=2){let l=Math.floor(o/7)+2;a-=(25*l-10)*l-55,o>=7&&(a-=36)}return r(208<=a&&a<=29648),a}static getNumDataCodewords(o,a){return Math.floor(t.getNumRawDataModules(o)/8)-t.ECC_CODEWORDS_PER_BLOCK[a.ordinal][o]*t.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][o]}static reedSolomonComputeDivisor(o){if(o<1||o>255)throw new RangeError("Degree out of range");let a=[];for(let u=0;u<o-1;u++)a.push(0);a.push(1);let l=1;for(let u=0;u<o;u++){for(let m=0;m<a.length;m++)a[m]=t.reedSolomonMultiply(a[m],l),m+1<a.length&&(a[m]^=a[m+1]);l=t.reedSolomonMultiply(l,2)}return a}static reedSolomonComputeRemainder(o,a){let l=a.map(u=>0);for(let u of o){let m=u^l.shift();l.push(0),a.forEach((p,f)=>l[f]^=t.reedSolomonMultiply(p,m))}return l}static reedSolomonMultiply(o,a){if(o>>>8||a>>>8)throw new RangeError("Byte out of range");let l=0;for(let u=7;u>=0;u--)l=l<<1^(l>>>7)*285,l^=(a>>>u&1)*o;return r(l>>>8==0),l}finderPenaltyCountPatterns(o){let a=o[1];r(a<=this.size*3);let l=a>0&&o[2]==a&&o[3]==a*3&&o[4]==a&&o[5]==a;return(l&&o[0]>=a*4&&o[6]>=a?1:0)+(l&&o[6]>=a*4&&o[0]>=a?1:0)}finderPenaltyTerminateAndCount(o,a,l){return o&&(this.finderPenaltyAddHistory(a,l),a=0),a+=this.size,this.finderPenaltyAddHistory(a,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(o,a){a[0]==0&&(o+=this.size),a.pop(),a.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]]}c.QrCode=t;function e(s,o,a){if(o<0||o>31||s>>>o)throw new RangeError("Value out of range");for(let l=o-1;l>=0;l--)a.push(s>>>l&1)}function n(s,o){return(s>>>o&1)!=0}function r(s){if(!s)throw new Error("Assertion error")}class i{constructor(o,a,l){this.mode=o;this.numChars=a;this.bitData=l;if(a<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}mode;numChars;bitData;static makeBytes(o){let a=[];for(let l of o)e(l,8,a);return new i(i.Mode.BYTE,o.length,a)}static makeNumeric(o){if(!i.isNumeric(o))throw new RangeError("String contains non-numeric characters");let a=[];for(let l=0;l<o.length;){let u=Math.min(o.length-l,3);e(parseInt(o.substr(l,u),10),u*3+1,a),l+=u}return new i(i.Mode.NUMERIC,o.length,a)}static makeAlphanumeric(o){if(!i.isAlphanumeric(o))throw new RangeError("String contains unencodable characters in alphanumeric mode");let a=[],l;for(l=0;l+2<=o.length;l+=2){let u=i.ALPHANUMERIC_CHARSET.indexOf(o.charAt(l))*45;u+=i.ALPHANUMERIC_CHARSET.indexOf(o.charAt(l+1)),e(u,11,a)}return l<o.length&&e(i.ALPHANUMERIC_CHARSET.indexOf(o.charAt(l)),6,a),new i(i.Mode.ALPHANUMERIC,o.length,a)}static makeSegments(o){return o==""?[]:i.isNumeric(o)?[i.makeNumeric(o)]:i.isAlphanumeric(o)?[i.makeAlphanumeric(o)]:[i.makeBytes(i.toUtf8ByteArray(o))]}static makeEci(o){let a=[];if(o<0)throw new RangeError("ECI assignment value out of range");if(o<128)e(o,8,a);else if(o<16384)e(2,2,a),e(o,14,a);else if(o<1e6)e(6,3,a),e(o,21,a);else throw new RangeError("ECI assignment value out of range");return new i(i.Mode.ECI,0,a)}static isNumeric(o){return i.NUMERIC_REGEX.test(o)}static isAlphanumeric(o){return i.ALPHANUMERIC_REGEX.test(o)}getData(){return this.bitData.slice()}static getTotalBits(o,a){let l=0;for(let u of o){let m=u.mode.numCharCountBits(a);if(u.numChars>=1<<m)return 1/0;l+=4+m+u.bitData.length}return l}static toUtf8ByteArray(o){o=encodeURI(o);let a=[];for(let l=0;l<o.length;l++)o.charAt(l)!="%"?a.push(o.charCodeAt(l)):(a.push(parseInt(o.substr(l+1,2),16)),l+=2);return a}static NUMERIC_REGEX=/^[0-9]*$/;static ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/;static ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"}c.QrSegment=i})(gt||={});(e=>{let t;(r=>{class n{constructor(c,s){this.ordinal=c;this.formatBits=s}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||={})})(gt||={});(e=>{let t;(r=>{class n{constructor(c,s){this.modeBits=c;this.numBitsCharCount=s}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(c){return this.numBitsCharCount[Math.floor((c+7)/17)]}}r.Mode=n})(t=e.QrSegment||={})})(gt||={});var Q=gt;var tt={L:Q.QrCode.Ecc.LOW,M:Q.QrCode.Ecc.MEDIUM,Q:Q.QrCode.Ecc.QUARTILE,H:Q.QrCode.Ecc.HIGH},kt=128,yt="Q",et="#FFFFFF",zt="#000000";var Bt=0;var qt=.1;import{z as nt}from"zod";var ur=["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"],bt=24;var re=.5,xt=1.5,mr=nt.enum(ur),oe=nt.object({style:mr,text:nt.string().max(bt).optional(),color:nt.string().optional(),textColor:nt.string().optional(),secondaryText:nt.string().max(bt).optional(),secondaryColor:nt.string().optional(),fontScale:nt.number().min(re).max(xt).optional()});import{z as S}from"zod";function pr(t,e=3){let n=10**e;return Math.round(t*n)/n+0}function b(t,e=3){return String(pr(t,e))}function Dt(t,...e){let n=t[0]??"";for(let r=0;r<e.length;r++){let i=e[r];n+=(typeof i=="number"?b(i):i)+(t[r+1]??"")}return n}var dr={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0},fr=/^[MmLlHhVvCcSsQqTtAaZz0-9.,+\-\s]*$/,ie=/[+-]?(?:\d+\.?\d*|\.\d+)/y;function Ct(t,e=Number.POSITIVE_INFINITY){if(!fr.test(t))return null;let n=[],r=0,i=()=>{for(;r<t.length&&/[\s,]/.test(t[r]);)r++},c=()=>{i(),ie.lastIndex=r;let a=ie.exec(t);if(!a)return null;let l=a[0],u=l.indexOf(".");if(u>=0&&l.length-u-1>e)return null;r=ie.lastIndex;let m=Number(l);return Number.isFinite(m)?m:null},s=()=>{i();let a=t[r];return a==="0"||a==="1"?(r++,a==="1"?1:0):null},o=()=>(i(),r<t.length&&/[0-9.+-]/.test(t[r]));for(i();r<t.length;){let a=t[r],l=a.toUpperCase(),u=dr[l];if(u===void 0||n.length===0&&l!=="M")return null;if(r++,u===0){n.push({command:a,values:[]}),i();continue}let m=a,p=!0;for(;p||o();){let f=[];for(let y=0;y<u;y++){let h=l==="A"&&(y===3||y===4)?s():c();if(h===null)return null;f.push(h)}n.push({command:m,values:f}),l==="M"&&(m=a==="M"?"L":"l"),p=!1}i()}return n}function Ne(t){let e=0;for(let{command:n}of t)e+=n.toUpperCase()==="A"?4:1;return e}function ae(t,e=1,n=0,r=0){let i="";for(let{command:c,values:s}of t){let o=c.toUpperCase(),a=c===o,l=a?n:0,u=a?r:0,m;switch(o){case"Z":m=[];break;case"H":m=[b(s[0]*e+l)];break;case"V":m=[b(s[0]*e+u)];break;case"A":m=[b(Math.abs(s[0])*e),b(Math.abs(s[1])*e),b(s[2]),String(s[3]),String(s[4]),b(s[5]*e+l),b(s[6]*e+u)];break;default:m=s.map((p,f)=>b(p*e+(f%2===0?l:u)))}i+=c+m.join(" ")}return i}function ke(t,e=.25){let n=[],r=[],i=[0,0],c=[0,0],s=()=>{r.length>2&&n.push(r),r=[]};for(let o of t)if(o.op==="M")s(),i=[o.x,o.y],c=i,r.push(i);else if(o.op==="L")c=[o.x,o.y],r.push(c);else if(o.op==="C"){let a=c,l=[o.x1,o.y1],u=[o.x2,o.y2],m=[o.x,o.y],p=Math.hypot(l[0]-a[0],l[1]-a[1])+Math.hypot(u[0]-l[0],u[1]-l[1])+Math.hypot(m[0]-u[0],m[1]-u[1]),f=Math.max(2,Math.min(64,Math.ceil(Math.sqrt(p/(4*e)))));for(let y=1;y<=f;y++){let h=y/f,g=1-h;r.push([g*g*g*a[0]+3*g*g*h*l[0]+3*g*h*h*u[0]+h*h*h*m[0],g*g*g*a[1]+3*g*g*h*l[1]+3*g*h*h*u[1]+h*h*h*m[1]])}c=m}else s(),c=i;return s(),n}function Gt(t,e){let n=[i=>i[0]-e.x0,i=>e.x1-i[0],i=>i[1]-e.y0,i=>e.y1-i[1]],r=t;for(let i of n){if(r.length===0)break;let c=r;r=[];for(let s=0;s<c.length;s++){let o=c[s],a=c[(s+c.length-1)%c.length],l=i(o),u=i(a);l>=0?(u<0&&r.push(Oe(a,o,u,l)),r.push(o)):u>=0&&r.push(Oe(a,o,u,l))}}return r.length>2?r:[]}function Oe(t,e,n,r){let i=n/(n-r);return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i]}function ze(t){return t.filter(e=>e.length>2).map(e=>`M${e.map(([n,r])=>`${b(n)} ${b(r)}`).join("L")}Z`).join("")}function Be(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY,c=(s,o)=>{e=Math.min(e,s),n=Math.min(n,o),r=Math.max(r,s),i=Math.max(i,o)};for(let s of t)s.op==="C"?(c(s.x1,s.y1),c(s.x2,s.y2),c(s.x,s.y)):s.op!=="Z"&&c(s.x,s.y);return Number.isFinite(e)?{x0:e,y0:n,x1:r,y1:i}:null}var se=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y;function hr(t,e,n,r,i,c,s,o,a){if(t===o&&e===a)return[];let l=Math.abs(n),u=Math.abs(r);if(l===0||u===0)return[{op:"L",x:o,y:a}];let m=i*Math.PI/180,p=Math.cos(m),f=Math.sin(m),y=(t-o)/2,h=(e-a)/2,g=p*y+f*h,x=-f*y+p*h,d=g*g/(l*l)+x*x/(u*u);d>1&&(l*=Math.sqrt(d),u*=Math.sqrt(d));let C=l*l*u*u-l*l*x*x-u*u*g*g,M=l*l*x*x+u*u*g*g,F=(c===s?-1:1)*Math.sqrt(Math.max(0,C/M)),P=F*l*x/u,E=-F*u*g/l,I=p*P-f*E+(t+o)/2,w=f*P+p*E+(e+a)/2,N=(G,U,V,dt)=>Math.atan2(G*dt-U*V,G*V+U*dt),B=N(1,0,(g-P)/l,(x-E)/u),H=N((g-P)/l,(x-E)/u,(-g-P)/l,(-x-E)/u);!s&&H>0?H-=2*Math.PI:s&&H<0&&(H+=2*Math.PI);let Y=Math.max(1,Math.ceil(Math.abs(H)/(Math.PI/2)-1e-9)),D=H/Y,K=4/3*Math.tan(D/4),it=(G,U)=>[I+l*p*G-u*f*U,w+l*f*G+u*p*U],pt=[];for(let G=0;G<Y;G++){let U=B+G*D,V=U+D,[dt,$t]=it(Math.cos(U)-K*Math.sin(U),Math.sin(U)+K*Math.cos(U)),[Mt,v]=it(Math.cos(V)+K*Math.sin(V),Math.sin(V)-K*Math.cos(V)),[j,J]=G===Y-1?[o,a]:it(Math.cos(V),Math.sin(V));pt.push({op:"C",x1:dt,y1:$t,x2:Mt,y2:v,x:j,y:J})}return pt}function Qt(t){let e=[],n=0,r=0,i=0,c=0,s=0,o="",a=null,l=null,u=()=>{for(;n<t.length&&/[\s,]/.test(t[n]);)n++},m=()=>{u(),se.lastIndex=n;let y=se.exec(t);return y?(n=se.lastIndex,Number(y[0])):null},p=()=>{u();let y=t[n];return y==="0"||y==="1"?(n++,y==="1"):null},f=y=>{let h=[];for(let g=0;g<y;g++){let x=m();if(x===null)return null;h.push(x)}return h};for(;u(),!(n>=t.length);){let y=t[n];if(/[MmLlHhVvCcSsQqTtAaZz]/.test(y))o=y,n++;else if(!o||o==="Z"||o==="z")break;let h=o===o.toLowerCase(),g=h?r:0,x=h?i:0,d=o.toUpperCase();if(d==="Z"){e.push({op:"Z"}),r=c,i=s,a=null,l=null;continue}if(d==="A"){let P=f(3),E=p(),I=p(),w=f(2);if(!(P&&w)||E===null||I===null)break;let[N,B,H]=P,Y=w[0]+g,D=w[1]+x;e.push(...hr(r,i,N,B,H,E,I,Y,D)),r=Y,i=D,a=null,l=null;continue}let C={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2}[d]??0,M=f(C);if(!M)break;let F=M;switch(d){case"M":r=F[0]+g,i=F[1]+x,c=r,s=i,e.push({op:"M",x:r,y:i}),o=h?"l":"L",a=null,l=null;break;case"L":case"H":case"V":d!=="V"&&(r=F[0]+g),d==="V"?i=F[0]+x:d==="L"&&(i=F[1]+x),e.push({op:"L",x:r,y:i}),a=null,l=null;break;case"C":case"S":{let P,E;d==="C"?(P=[F[0]+g,F[1]+x],E=F.slice(2)):(P=a?[2*r-a[0],2*i-a[1]]:[r,i],E=F);let I=[E[0]+g,E[1]+x],w=[E[2]+g,E[3]+x];e.push({op:"C",x1:P[0],y1:P[1],x2:I[0],y2:I[1],x:w[0],y:w[1]}),[r,i]=w,a=I,l=null;break}case"Q":case"T":{let P,E;d==="Q"?(P=[F[0]+g,F[1]+x],E=[F[2]+g,F[3]+x]):(P=l?[2*r-l[0],2*i-l[1]]:[r,i],E=[F[0]+g,F[1]+x]),e.push({op:"C",x1:r+2/3*(P[0]-r),y1:i+2/3*(P[1]-i),x2:E[0]+2/3*(P[0]-E[0]),y2:E[1]+2/3*(P[1]-E[1]),x:E[0],y:E[1]}),[r,i]=E,l=P,a=null;break}default:break}}return e}var qe=.5522847498;function le(t,e,n,r,i=0,c=0){if(n<=0||r<=0)return[];let s=Math.min(Math.max(i,0),n/2),o=Math.min(Math.max(c,0),r/2);if(s===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 a=s*qe,l=o*qe,u=t+n,m=e+r;return[{op:"M",x:t+s,y:e},{op:"L",x:u-s,y:e},{op:"C",x1:u-s+a,y1:e,x2:u,y2:e+o-l,x:u,y:e+o},{op:"L",x:u,y:m-o},{op:"C",x1:u,y1:m-o+l,x2:u-s+a,y2:m,x:u-s,y:m},{op:"L",x:t+s,y:m},{op:"C",x1:t+s-a,y1:m,x2:t,y2:m-o+l,x:t,y:m-o},{op:"L",x:t,y:e+o},{op:"C",x1:t,y1:e+o-l,x2:t+s-a,y2:e,x:t+s,y:e},{op:"Z"}]}var gr="qrdx.frame",yr=1,me="custom",O={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:bt},br=["wifi","star","heart","phone","headphones","calendar","user","chat","bag","bell","cup","card","check","info","home","pin","share","download","clock","snowflake","pumpkin","tree","sparkle","gift"],Ht=.95,xr=200,Sr=["frame","text","accent","background"],Mr=/[\t\n\v\f\r\u0085\u2028\u2029]/g,Er=/[\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 pe(t,e=bt){let n=t.slice(0,1e3).normalize("NFC").replace(Mr," ").replace(Er,"").replace(/\s+/g," ").trim();return Array.from(n).slice(0,Math.max(0,e)).join("").trim()}var de=t=>Math.abs(t*1e3-Math.round(t*1e3))<1e-6,_=S.number().min(-O.maxCoordinate).max(O.maxCoordinate).refine(de,{message:`Numbers may have at most ${O.maxDecimals} decimals`}),k=_.refine(t=>t>0,{message:"Must be greater than 0"}),Ut=_.refine(t=>t>=0,{message:"Must not be negative"}),Rt=S.string().regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,"Use a #rgb or #rrggbb color"),De=S.union([S.enum(Sr),Rt]),Ue=t=>S.object({mix:S.tuple([t,t]),amount:S.number().min(0).max(1).refine(de)}).strict(),Pt=S.union([De,Ue(De)]),Fr=S.union([Rt,Ue(S.union([S.enum(["frame","accent","background"]),Rt]))]),lt=S.union([Pt,S.object({gradient:S.object({from:Pt,to:Pt,direction:S.enum(["horizontal","vertical"]).optional(),steps:S.int().min(2).max(O.maxGradientSteps).optional()}).strict()}).strict()]),ce={x:_,y:_,width:k,height:k},Cr=S.object({type:S.literal("rect"),...ce,radius:Ut.optional(),fill:lt,hole:S.object({...ce,radius:Ut.optional()}).strict().optional()}).strict(),Pr=S.object({type:S.literal("circle"),cx:_,cy:_,r:k,hole:k.optional(),fill:lt}).strict(),Rr=S.object({type:S.literal("ellipse"),cx:_,cy:_,rx:k,ry:k,fill:lt}).strict(),Ar=S.object({type:S.literal("polygon"),points:S.array(S.tuple([_,_])).min(3).max(O.maxPolygonPoints),fill:lt}).strict(),wr=S.object({type:S.literal("path"),d:S.string().min(2).max(O.maxPathLength),fill:lt,fillRule:S.enum(["nonzero","evenodd"]).optional()}).strict(),Lr=S.object({type:S.literal("line"),x1:_,y1:_,x2:_,y2:_,width:k,cap:S.enum(["butt","round"]).optional(),dash:S.tuple([k,k]).optional(),fill:lt}).strict(),Ir=S.object({type:S.literal("icon"),icon:S.enum(br),x:_,y:_,size:k,fill:lt}).strict(),vr=S.discriminatedUnion("type",[Cr,Pr,Rr,Ar,wr,Lr,Ir]),He={id:S.string().regex(/^[a-z][a-z0-9-]{0,31}$/),slot:S.enum(["primary","secondary","fixed"]),text:S.string().max(200),maxLength:S.int().min(1).max(bt).optional(),color:Pt,weight:S.enum(["bold","regular"]).optional(),collapse:S.object({y:_,height:k}).strict().optional()},_r=S.object({type:S.literal("text"),...He,box:S.object(ce).strict(),align:S.enum(["start","middle","end"]).optional(),fontSize:k.optional()}).strict(),$r=S.object({type:S.literal("curved"),...He,curve:S.object({cx:_,cy:_,radius:k,side:S.enum(["top","bottom"]),spread:S.number().min(20).max(300).refine(de).optional()}).strict(),fontSize:k}).strict(),Tr=S.discriminatedUnion("type",[_r,$r]),Ge=_.refine(t=>t>=O.minArtboard&&t<=O.maxArtboard,{message:`Artboard sides must be ${O.minArtboard} to ${O.maxArtboard} units`}),Nr=S.object({kind:S.literal(gr),version:S.literal(yr),artboard:S.object({width:Ge,height:Ge}).strict(),qr:S.object({x:_,y:_,size:k,padding:Ut.optional(),radius:Ut.optional(),plate:S.enum(["opaque","background"]).optional()}).strict(),colors:S.object({frame:Rt,text:Fr.optional(),accent:Rt.optional()}).strict(),shapes:S.array(vr).max(O.maxShapes),labels:S.array(Tr).max(O.maxLabels),bleed:S.union([S.literal("none"),Pt]).optional()}).strict();function fe(t){let e=Vt(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 Or(t){return{x0:t.qr.x,y0:t.qr.y,x1:t.qr.x+t.qr.size,y1:t.qr.y+t.qr.size}}function Vt(t){return t.qr.padding??t.qr.size*O.defaultPadding}var he=.52,kr=.35;function zr(t){let e=t.fontSize??t.box.height*he;return Math.min(e*xt,t.box.height*Ht)}var ue=(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 Qe(t){let e=fe(t),n=Math.min(t.qr.radius??0,(e.x1-e.x0)/2,(e.y1-e.y0)/2),r=[[e.x0+n,e.y0+n,Math.PI],[e.x1-n,e.y0+n,-Math.PI/2],[e.x1-n,e.y1-n,0],[e.x0+n,e.y1-n,Math.PI/2]],i=[];for(let[c,s,o]of r)for(let a=0;a<=8;a++){let l=o+Math.PI/2*(a/8);i.push([c+n*Math.cos(l),s+n*Math.sin(l)])}return i}function Br([t,e],n,r){if(t<n.x-.01||e<n.y-.01||t>n.x+n.width+.01||e>n.y+n.height+.01)return!1;let c=Math.min(r,n.width/2,n.height/2),s=Math.min(Math.max(t,n.x+c),n.x+n.width-c),o=Math.min(Math.max(e,n.y+c),n.y+n.height-c);return Math.hypot(t-s,e-o)<=c+.01}function qr(t){let e=0;return t.forEach(([n,r],i)=>{let[c,s]=t[(i+1)%t.length];e+=n*s-c*r}),Math.abs(e)/2}function Dr(t,e,n){let r=fe(e);if(t.fill==="background"||!ue(n,r))return!1;if(t.type==="rect"&&t.hole){let{hole:i}=t;return!Qe(e).every(c=>Br(c,i,i.radius??0))}if(t.type==="circle"&&t.hole){let i=t.hole;return!Qe(e).every(([c,s])=>Math.hypot(c-t.cx,s-t.cy)<=i+.01)}if(t.type==="polygon"){let i=Gt(t.points,r);return i.length>2&&qr(i)>1e-6}return!0}function ge(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=Ct(t.d,O.maxDecimals);return e?{bounds:Be(Qt(t.d)),segments:Ne(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:xr}}}function Gr(t,e){let n=(d,C=[])=>e.addIssue({code:"custom",message:d,path:C}),r=O,i=new TextEncoder().encode(JSON.stringify(t)).length;if(i>r.maxBytes){n(`The spec is ${i} bytes; the limit is ${r.maxBytes}`);return}let{width:c,height:s}=t.artboard,o=Math.max(c,s)*.005,a={x0:-o,y0:-o,x1:c+o,y1:s+o},l=d=>d.x0>=a.x0&&d.y0>=a.y0&&d.x1<=a.x1&&d.y1<=a.y1,{qr:u}=t,m=Vt(t);m<u.size*r.minPadding-1e-9&&n(`qr.padding must be at least ${r.minPadding*100}% of qr.size`,["qr","padding"]),u.size<Math.min(c,s)*r.minQrShare-1e-9&&n(`qr.size must be at least ${r.minQrShare*100}% of the artboard's shorter side`,["qr","size"]);let p=fe(t);(p.x0<-1e-9||p.y0<-1e-9||p.x1>c+1e-9||p.y1>s+1e-9)&&n("The code and its padding must sit inside the artboard",["qr"]),(u.radius??0)>(u.size+2*m)/2&&n("qr.radius is larger than half the plate",["qr","radius"]);let f=0,y=0;t.shapes.forEach((d,C)=>{let M=["shapes",C],{bounds:F,segments:P}=ge(d);if(!F){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",[...M,"d"]);return}if(l(F)||n("The shape extends outside the artboard",M),d.type==="rect"&&d.hole){let{hole:E}=d;(E.x<d.x||E.y<d.y||E.x+E.width>d.x+d.width+1e-9||E.y+E.height>d.y+d.height+1e-9)&&n("The hole must sit inside its rect",[...M,"hole"])}d.type==="circle"&&d.hole&&d.hole>=d.r&&n("The hole must be smaller than the circle",[...M,"hole"]),u.plate==="background"&&Dr(d,t,F)&&n('With qr.plate "background", only background fills (or a ring whose hole holds the plate) may lie under the plate',M),f+=P,typeof d.fill=="object"&&"gradient"in d.fill&&(y+=(d.fill.gradient.steps??32)*P)}),f>r.maxSegments&&n(`The shapes have ${f} segments; the limit is ${r.maxSegments}`,["shapes"]),y>r.maxGradientWork&&n("Gradient fills are too detailed (fewer steps or simpler shapes)",["shapes"]);let h=[],g=new Set,x=new Set;t.labels.forEach((d,C)=>{let M=["labels",C];g.has(d.id)&&n(`Label id "${d.id}" is used twice`,[...M,"id"]),g.add(d.id),d.slot!=="fixed"&&(x.has(d.slot)&&n(`Only one label may use the ${d.slot} slot`,[...M,"slot"]),x.add(d.slot));let F=d.maxLength??r.maxTextLength;d.text!==pe(d.text,F)&&n(`Label text must be at most ${F} characters, trimmed, with no control or invisible characters (see sanitizeFrameText)`,[...M,"text"]);let P;if(d.type==="text"){P={x0:d.box.x,y0:d.box.y,x1:d.box.x+d.box.width,y1:d.box.y+d.box.height},d.fontSize!==void 0&&d.fontSize>d.box.height*Ht+1e-9&&n("fontSize may be at most 95% of the label's row height",[...M,"fontSize"]);let E=d.box.y+d.box.height/2,I=zr(d)*kr,w={x0:P.x0,x1:P.x1,y0:E-I,y1:E+I};(ue(P,Or(t))||ue(w,p))&&n("The label overlaps the code or its padding",[...M,"box"])}else{let{cx:E,cy:I,radius:w}=d.curve,N=d.fontSize*xt*.6;P={x0:E-w-N,y0:I-w-N,x1:E+w+N,y1:I+w+N};let B=Math.hypot(Math.max(p.x0-E,0,E-p.x1),Math.max(p.y0-I,0,I-p.y1));Math.hypot(Math.max(Math.abs(p.x0-E),Math.abs(p.x1-E)),Math.max(Math.abs(p.y0-I),Math.abs(p.y1-I)))<=w-N||B>=w+N||n("The curved label crosses the code or its padding",[...M,"curve"])}if(l(P)||n("The label extends outside the artboard",M),d.collapse){let E=d.collapse,I=E.y+E.height;(E.y<-1e-9||I>s+1e-9)&&n("The collapse band must sit inside the artboard",[...M,"collapse"]),I>p.y0+1e-6&&E.y<p.y1-1e-6&&n("The collapse band crosses the code or its padding",[...M,"collapse"]);for(let w of h)I>w.y+1e-6&&E.y<w.y+w.height-1e-6&&n("Collapse bands may not overlap",[...M,"collapse"]);h.push(E)}})}var ye=Nr.superRefine(Gr);var Qr=oe.extend({style:S.literal(me),spec:ye}),Ve=S.discriminatedUnion("style",[oe,Qr]);function q(t){if(t.length===0)return"";let[e,...n]=t;return`M${b(e[0])} ${b(e[1])}${n.map(([r,i])=>`L${b(r)} ${b(i)}`).join("")}Z`}function $(t,e,n){return`M${b(t-n)} ${b(e)}A${b(n)} ${b(n)} 0 1 1 ${b(t+n)} ${b(e)}A${b(n)} ${b(n)} 0 1 1 ${b(t-n)} ${b(e)}Z`}function A(t,e,n,r,i=0){let c=Math.min(n,r)/2,[s,o,a,l]=(typeof i=="number"?[i,i,i,i]:i).map(m=>Math.max(0,Math.min(m,c))),u=(m,p,f)=>m>0?`A${b(m)} ${b(m)} 0 0 1 ${b(p)} ${b(f)}`:"";return`M${b(t+s)} ${b(e)}H${b(t+n-o)}${u(o,t+n,e+o)}V${b(e+r-a)}${u(a,t+n-a,e+r)}H${b(t+l)}${u(l,t,e+r-l)}V${b(e+s)}${u(s,t+s,e)}Z`}function Yt(t,e,n,r,i=5){return Array.from({length:i*2},(c,s)=>{let o=s%2===0?n:r,a=-Math.PI/2+Math.PI/i*s;return[t+o*Math.cos(a),e+o*Math.sin(a)]})}function Ye(t,e,n){let r=n/2,i=(c,s)=>`${b(t+c*r)} ${b(e+s*r)}`;return`M${i(0,-.52)}C${i(.18,-.92)} ${i(.98,-.94)} ${i(1,-.34)}C${i(1,.12)} ${i(.5,.48)} ${i(0,.92)}C${i(-.5,.48)} ${i(-1,.12)} ${i(-1,-.34)}C${i(-.98,-.94)} ${i(-.18,-.92)} ${i(0,-.52)}Z`}function be(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,rt=(t,e,n,r)=>{let i=r*Math.PI/180;return[t+n*Math.cos(i),e+n*Math.sin(i)]},jt=([t,e])=>`${b(t)} ${b(e)}`;function St(t,e,n,r,i,c){let s=c-i>180?1:0;return`M${jt(rt(t,e,r,i))}A${b(r)} ${b(r)} 0 ${s} 1 ${jt(rt(t,e,r,c))}L${jt(rt(t,e,n,c))}A${b(n)} ${b(n)} 0 ${s} 0 ${jt(rt(t,e,n,i))}Z`}function At(t,e,n,r){return`M${b(t-n)} ${b(e)}A${b(n)} ${b(r)} 0 1 1 ${b(t+n)} ${b(e)}A${b(n)} ${b(r)} 0 1 1 ${b(t-n)} ${b(e)}Z`}function Ur(t){let e=0;return t.forEach(([n,r],i)=>{let[c,s]=t[(i+1)%t.length];e+=n*s-c*r}),e/2}function Ze(t){return q(Ur(t)<0?[...t].reverse():t)}function Zt(t,e,n,r,i){let c=Math.hypot(n-t,r-e)||1,s=-(r-e)/c*(i/2),o=(n-t)/c*(i/2);return Ze([[t+s,e+o],[n+s,r+o],[n-s,r-o],[t-s,e-o]])}var z=(...t)=>({d:t.join(""),fillRule:"nonzero"}),Z=(...t)=>({d:t.join(""),fillRule:"evenodd"});function Hr(){let t=[];for(let e of[0,60,120]){let[n,r]=rt(12,12,10.5,e+180),[i,c]=rt(12,12,10.5,e);t.push(Zt(n,r,i,c,2))}for(let e=0;e<6;e++){let n=e*60,[r,i]=rt(12,12,6.2,n);for(let c of[-45,45]){let[s,o]=rt(r,i,3.6,n+c);t.push(Zt(r,i,s,o,1.7))}}return z(...t)}var Vr={wifi:()=>z(St(12,20,4.6,7.2,-135,-45),St(12,20,9.2,11.8,-135,-45),St(12,20,13.8,16.4,-135,-45),$(12,20,2.2)),star:()=>z(q(Yt(12,12.8,11.6,4.8))),heart:()=>z(Ye(12,12.4,22)),phone:()=>Z(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(St(12,13,7.6,9.8,-180,0),A(2,12,5,9.5,2),A(17,12,5,9.5,2)),calendar:()=>Z(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:()=>Z(A(2,3,20,14,4),q([[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),St(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",St(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:()=>Z(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:()=>Z($(12,12,10.5),q([[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:()=>Z($(12,12,10.5),$(12,7.2,1.6),A(10.6,10,2.8,8,.8)),home:()=>Z(q([[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:()=>Z("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(Zt(6,12,18,5,1.8),Zt(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),q([[6,10],[18,10],[12,16.5]]),q([[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:()=>Z($(12,12,10.5),$(12,12,8.4),q([[11,5.4],[13,5.4],[13,11.3],[16.9,13.5],[15.9,15.2],[11,12.5]])),snowflake:Hr,pumpkin:()=>z(At(7.8,14.6,5.8,6.9),At(16.2,14.6,5.8,6.9),At(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(q([[12,1.5],[16.8,8.2],[7.2,8.2]]),q([[12,5.2],[19,13.6],[5,13.6]]),q([[12,9.4],[21.2,19.2],[2.8,19.2]]),A(10.4,18.6,3.2,3.9,.4)),sparkle:()=>z(q(Yt(9.5,13.5,9,2.4,4)),q(Yt(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),At(8.8,4.8,2.9,1.9),At(15.2,4.8,2.9,1.9))};function Xe(t){return Vr[t]()}var Yr={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 We(t,e){let n=t.trim(),r=Number.parseFloat(n);return Number.isNaN(r)?Number.NaN:n.endsWith("%")?r/100*e:r}function wt(t){if(!t)return null;let e=t.trim().toLowerCase();if(e==="transparent")return{r:0,g:0,b:0,a:0};let n=Yr[e];if(n)return{r:n[0],g:n[1],b:n[2],a:1};if(e.startsWith("#")){let i=e.slice(1);return(i.length===3||i.length===4)&&(i=i.split("").map(c=>c+c).join("")),/^[0-9a-f]{6}([0-9a-f]{2})?$/.test(i)?{r:Number.parseInt(i.slice(0,2),16),g:Number.parseInt(i.slice(2,4),16),b:Number.parseInt(i.slice(4,6),16),a:i.length===8?Number.parseInt(i.slice(6,8),16)/255:1}:null}let r=/^rgba?\(([^)]*)\)$/.exec(e);if(r){let[i,c]=r[1].split("/"),s=i.split(/[\s,]+/).filter(Boolean);if(s.length!==(c===void 0&&s.length===4?4:3))return null;let o=c??s[3],[a,l,u]=s.slice(0,3).map(f=>We(f,255)),m=o===void 0?1:We(o,1);if([a,l,u,m].some(f=>Number.isNaN(f)))return null;let p=(f,y)=>Math.min(Math.max(f,0),y);return{r:p(a,255),g:p(l,255),b:p(u,255),a:p(m,1)}}return null}function Ke(t){return t===" "?.3:/[MWmw@%]/.test(t)?.92:/[A-Z0-9#&]/.test(t)?.72:/[il.,:;!'|1]/.test(t)?.32:.6}function Se(t){let e=0;for(let n of t)e+=Ke(n);return Math.max(e,1)}var xe=t=>Math.round(Math.min(255,Math.max(0,t))).toString(16).padStart(2,"0");function Xt(t,e,n){let r=wt(t)??{r:0,g:0,b:0,a:1},i=wt(e)??{r:255,g:255,b:255,a:1},c=Math.min(1,Math.max(0,n));return`#${xe(r.r+(i.r-r.r)*c)}${xe(r.g+(i.g-r.g)*c)}${xe(r.b+(i.b-r.b)*c)}`}function Je(t,e,n,r,i,c,s,o){let a=[...t],l=i*.08,u=a.map(h=>Ke(h)*i),m=u.reduce((h,g)=>h+g,0)+l*Math.max(0,a.length-1),p=c==="top"?r-i*.35:r+i*.35,f=[],y=0;return a.forEach((h,g)=>{let x=u[g],d=(y+x/2)/p;if(y+=x+l,h.trim()==="")return;let C=c==="top"?-Math.PI/2-m/2/p+d:Math.PI/2+m/2/p-d;f.push({text:h,x:e+p*Math.cos(C),y:n+p*Math.sin(C),fontSize:i,maxWidth:i*2,color:s,rotate:C*180/Math.PI+(c==="top"?90:-90),field:o})}),f}function Lt(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 Wt=class extends Error{issues;constructor(e){super(`Invalid frame spec: ${e.slice(0,5).join("; ")}`),this.name="FrameSpecError",this.issues=e}},tn=new WeakMap;function Me(t){if(t&&typeof t=="object"){let n=tn.get(t);if(n)return n}if(t==null)throw new Wt(['A "custom" frame needs a spec']);let e=ye.safeParse(t);if(!e.success)throw new Wt(e.error.issues.map(n=>n.path.length>0?`${n.path.join(".")}: ${n.message}`:n.message));return typeof t=="object"&&tn.set(t,e.data),e.data}var jr=t=>{let e=wt(t);return!!(e&&e.a>=1)};function Zr(t,e){let n=Lt(e,et);return jr(n)?{color:n,plate:!0}:t.qr.plate==="background"?{color:n,plate:!1}:{color:et,plate:!0}}function nn(t,e,n=et){let r=e.color||t.colors.frame,i=e.secondaryColor||t.colors.accent||r,c=a=>a==="frame"?r:a==="accent"?i:a==="background"?n:a,s=t.colors.text,o=e.textColor||(s===void 0?r:typeof s=="string"?s:Xt(c(s.mix[0]),c(s.mix[1]),s.amount));return{frame:r,text:o,accent:i}}function Xr(t,e,n){let r=nn(e,t,n),i=c=>{switch(c){case"frame":return r.frame;case"text":return r.text;case"accent":return r.accent;case"background":return n;default:return c}};return c=>typeof c=="string"?i(c):Xt(i(c.mix[0]),i(c.mix[1]),c.amount)}function en(t,e,n=0,r=0){let i=Ct(t);return i?ae(i,e,n,r):""}function Wr(t,e,n,r){return`M${b(t-n)} ${b(e)}A${b(n)} ${b(r)} 0 1 1 ${b(t+n)} ${b(e)}A${b(n)} ${b(r)} 0 1 1 ${b(t-n)} ${b(e)}Z`}function Kr(t,e){let[n,r,i,c]=[t.x1*e,t.y1*e,t.x2*e,t.y2*e],s=Math.hypot(i-n,c-r),o=t.width*e/2,a=s>0?(i-n)/s:1,l=s>0?(c-r)/s:0,u=-l*o,m=a*o,p=(g,x)=>{let d=[n+a*g,r+l*g],C=[n+a*x,r+l*x];if(t.cap==="round"&&x-g>2*o){let M=[d[0]+a*o,d[1]+l*o],F=[C[0]-a*o,C[1]-l*o];return`M${b(M[0]-u)} ${b(M[1]-m)}L${b(F[0]-u)} ${b(F[1]-m)}A${b(o)} ${b(o)} 0 0 1 ${b(F[0]+u)} ${b(F[1]+m)}L${b(M[0]+u)} ${b(M[1]+m)}A${b(o)} ${b(o)} 0 0 1 ${b(M[0]-u)} ${b(M[1]-m)}Z`}return`M${b(d[0]-u)} ${b(d[1]-m)}L${b(C[0]-u)} ${b(C[1]-m)}L${b(C[0]+u)} ${b(C[1]+m)}L${b(d[0]+u)} ${b(d[1]+m)}Z`};if(!t.dash)return{type:"path",d:p(0,s),fillRule:"nonzero"};let f=t.dash[0]*e,y=f+t.dash[1]*e,h=[];for(let g=0;g+f<=s+1e-6;g+=y)h.push(p(g,g+f));return{type:"path",d:h.join(""),fillRule:"nonzero"}}function Jr(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:Wr(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:en(t.d,e),fillRule:t.fillRule??"nonzero"};case"line":return Kr(t,e);default:{let n=Xe(t.icon);return{type:"path",d:en(n.d,t.size*e/je,t.x*e,t.y*e),fillRule:n.fillRule}}}}function to(t){if(t.type==="rect"){let{x:e,y:n,width:r,height:i,radius:c,hole:s}=t;return[...le(e,n,r,i,c,c),...s?le(s.x,s.y,s.width,s.height,s.radius,s.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"}]:Qt(t.d)}function eo(t,e,n){let r=to(t),i=ke(r,.2),c=t.type==="rect"?t.hole?"evenodd":"nonzero":t.type==="path"?t.fillRule??"nonzero":"nonzero",s=e.direction==="vertical",o=g=>s?g[1]:g[0],a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let g of i)for(let x of g)a=Math.min(a,o(x)),l=Math.max(l,o(x));if(!(l>a))return[];let u=e.steps??32,m=n(e.from),p=n(e.to),f=l-a,y=f*.002,h=[];for(let g=0;g<u;g++){let x=a+f*g/u,d=Math.min(l,a+f*(g+1)/u+(g+1<u?y:0)),C=s?{x0:Number.NEGATIVE_INFINITY,x1:Number.POSITIVE_INFINITY,y0:x,y1:d}:{x0:x,x1:d,y0:Number.NEGATIVE_INFINITY,y1:Number.POSITIVE_INFINITY},M=i.map(F=>Gt(F,C)).filter(F=>F.length>2);M.length!==0&&h.push({type:"path",d:ze(M),fill:Xt(m,p,(g+.5)/u),fillRule:c})}return h}function no(t,e,n){let r=Jr(t,e);return typeof t.fill=="object"&&"gradient"in t.fill?eo(r,t.fill.gradient,n):[{...r,fill:n(t.fill)}]}function ro(t,e){let n=Math.min(t.maxLength??O.maxTextLength,O.maxTextLength),r=t.slot==="primary"?e.text??t.text:t.slot==="secondary"?e.secondaryText??t.text:t.text;return pe(r,n)}function oo(t){return t===void 0||!Number.isFinite(t)?1:Math.min(xt,Math.max(re,t))}function io(t,e,n,r,i,c){let s=i(t.color),o=t.weight==="regular"?{fontWeight:400}:{};if(t.type==="curved"){let{cx:h,cy:g,radius:x,side:d,spread:C=140}=t.curve,M=x*r*(C*Math.PI/180),F=Math.min(t.fontSize*r*n,M/(Se(e)+.08*e.length));return Je(e,h*r,g*r,x*r,F,d,s,c).map(P=>({...P,...o}))}let a=t.box.x*r,l=t.box.y*r,u=t.box.width*r,m=t.box.height*r;if(!(m>0))return[];let p=(t.fontSize??t.box.height*he)*r,f=Math.min(p*n,m*Ht,u/Se(e)),y=t.align??"middle";return[{text:e,x:y==="start"?a:y==="end"?a+u:a+u/2,y:l+m/2+f*.35,fontSize:f,maxWidth:u,color:s,...y!=="middle"&&{align:y},...o,field:c}]}function ao(t){let e=0,n=0,r=0,i=0;return t.map(({command:c,values:s})=>{let o=c.toUpperCase(),a=c!==o;switch(o){case"Z":return e=r,n=i,{command:"Z",values:[]};case"H":return e=(a?e:0)+s[0],{command:"H",values:[e]};case"V":return n=(a?n:0)+s[0],{command:"V",values:[n]};case"A":return e=(a?e:0)+s[5],n=(a?n:0)+s[6],{command:"A",values:[...s.slice(0,5),e,n]};default:{let l=s.map((u,m)=>a?u+(m%2===0?e:n):u);return e=l.at(-2),n=l.at(-1),o==="M"&&(r=e,i=n),{command:o,values:l}}}})}function so(t,e){let n=Ct(t);return n?ae(ao(n).map(({command:r,values:i})=>r==="V"?{command:r,values:[e(i[0])]}:r==="H"||r==="Z"?{command:r,values:i}:r==="A"?{command:r,values:[...i.slice(0,6),e(i[6])]}:{command:r,values:i.map((c,s)=>s%2===1?e(c):c)})):t}function lo(t,e){let n=(r,i)=>{let c=e(r);return{y:c,height:e(r+i)-c}};switch(t.type){case"rect":return{...t,...n(t.y,t.height),...t.hole&&{hole:{...t.hole,...n(t.hole.y,t.hole.height)}}};case"circle":case"ellipse":return{...t,cy:e(t.cy)};case"polygon":return{...t,points:t.points.map(([r,i])=>[r,e(i)])};case"path":return{...t,d:so(t.d,e)};case"line":return{...t,y1:e(t.y1),y2:e(t.y2)};default:return{...t,y:e(t.y)}}}function co(t,e){if(e.length===0)return t;let n=i=>{let c=i;for(let s of e)c-=Math.min(Math.max(i-s.y,0),s.height);return c},r=(i,c)=>e.some(s=>i>=s.y-1e-6&&c<=s.y+s.height+1e-6);return{...t,artboard:{...t.artboard,height:n(t.artboard.height)},qr:{...t.qr,y:n(t.qr.y)},shapes:t.shapes.filter(i=>{let{bounds:c}=ge(i);return!(c&&r(c.y0,c.y1))}).map(i=>lo(i,n)),labels:t.labels.map(i=>{if(i.type==="curved")return{...i,curve:{...i.curve,cy:n(i.curve.cy)}};let c=n(i.box.y);return{...i,box:{...i.box,y:c,height:n(i.box.y+i.box.height)-c}}})}}function Ee(t,e,n,r,i={}){let c=new Map(e.labels.map(g=>[g.id,ro(g,n)])),s=co(e,e.labels.flatMap(g=>g.collapse&&!c.get(g.id)?[g.collapse]:[])),o=t/s.qr.size,a=Zr(s,r),l=Xr(n,s,a.color),u=s.shapes.flatMap(g=>no(g,o,l));if(a.plate){let g=Vt(s)*o;u.push({type:"rect",x:s.qr.x*o-g,y:s.qr.y*o-g,width:t+2*g,height:t+2*g,radius:(s.qr.radius??0)*o,fill:a.color})}let m=oo(n.fontScale),p=s.labels.flatMap(g=>{let x=c.get(g.id);if(!x)return[];let d=(g.slot==="fixed"?void 0:i[g.slot])??g.id;return io(g,x,m,o,l,d)}),f=p[0],y=f&&f.rotate===void 0?f:null,h=s.bleed??"none";return{width:s.artboard.width*o,height:s.artboard.height*o,qrX:s.qr.x*o,qrY:s.qr.y*o,qrSize:t,shapes:u,label:y,extraLabels:y?p.slice(1):p,squareEdges:h!=="none",color:l(h==="none"?"frame":h)}}function rn(t,e,n){return Ee(t,Me(e.spec),e,n)}var on={kind:"qrdx.frame",version:1,artboard:{width:1600,height:1470},qr:{x:300,y:120,size:1e3,padding:70,radius:10,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"polygon",points:[[0,1250],[190,1250],[190,1470],[0,1470],[50.4,1360]],fill:{mix:["frame","#000000"],amount:.28}},{type:"polygon",points:[[1600,1250],[1549.6,1360],[1600,1470],[1410,1470],[1410,1250]],fill:{mix:["frame","#000000"],amount:.28}},{type:"polygon",points:[[90,1420],[170,1470],[90,1470]],fill:{mix:["frame","#000000"],amount:.5}},{type:"polygon",points:[[1510,1420],[1510,1470],[1430,1470]],fill:{mix:["frame","#000000"],amount:.5}},{type:"rect",x:220,y:40,width:1160,height:1160,radius:20,fill:"background"},{type:"rect",x:180,y:0,width:1240,height:1240,radius:60,fill:"frame",hole:{x:220,y:40,width:1160,height:1160,radius:20}},{type:"rect",x:90,y:1200,width:1420,height:220,fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:170,y:1200,width:1260,height:220}}]};var Fe={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1420},qr:{x:120,y:120,size:1e3,padding:70,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:40,y:40,width:1160,height:1160,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1420,fill:"frame",hole:{x:40,y:40,width:1160,height:1160}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1200,width:1e3,height:220}}],bleed:"frame"};var an={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1420},qr:{x:120,y:300,size:1e3,padding:70,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:40,y:220,width:1160,height:1160,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1420,fill:"frame",hole:{x:40,y:220,width:1160,height:1160}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:0,width:1e3,height:220}}],bleed:"frame"};var sn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1600},qr:{x:120,y:300,size:1e3,padding:70,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:40,y:220,width:1160,height:1160,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1600,fill:"frame",hole:{x:40,y:220,width:1160,height:1160}}],labels:[{type:"text",id:"top",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:0,width:1e3,height:220}},{type:"text",id:"bottom",slot:"secondary",text:"",color:"text",box:{x:120,y:1380,width:1e3,height:220}}],bleed:"frame"};var ln={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1340},qr:{x:120,y:120,size:1e3,padding:40,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:40,y:40,width:1160,height:1260,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1340,fill:"frame",hole:{x:40,y:40,width:1160,height:1260}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1120,width:1e3,height:180},collapse:{y:1200,height:100}}],bleed:"frame"};var cn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1530},qr:{x:120,y:120,size:1e3,padding:80,radius:80},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:0,y:0,width:1240,height:1400,radius:120,fill:"frame"},{type:"path",d:"M161.2 1380L62 1530Q198.4 1458.5 396.8 1380Z",fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1200,width:1e3,height:200},collapse:{y:1220,height:160}}]};var un={kind:"qrdx.frame",version:1,artboard:{width:1978.214,height:1978.214},qr:{x:489.107,y:489.107,size:1e3,padding:50,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"circle",cx:989.107,cy:989.107,r:779.107,fill:"background"},{type:"circle",cx:989.107,cy:989.107,r:989.107,hole:779.107,fill:"frame"},{type:"circle",cx:105,cy:989.107,r:14.7,fill:"text"},{type:"circle",cx:1873.214,cy:989.107,r:14.7,fill:"text"}],labels:[{type:"curved",id:"top",slot:"primary",text:"Scan me",color:"text",curve:{cx:989.107,cy:989.107,radius:884.107,side:"top",spread:140},fontSize:105},{type:"curved",id:"bottom",slot:"secondary",text:"",color:"text",curve:{cx:989.107,cy:989.107,radius:884.107,side:"bottom",spread:140},fontSize:105}]};var mn={kind:"qrdx.frame",version:1,artboard:{width:1320,height:1558},qr:{x:160,y:130,size:1e3,padding:60},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:0,y:370,width:1320,height:1188,fill:{mix:["frame","#FFFFFF"],amount:.45}},{type:"polygon",points:[[0,370],[660,0],[1320,370]],fill:{mix:["frame","#FFFFFF"],amount:.25}},{type:"rect",x:80,y:50,width:1160,height:1268,fill:"background"},{type:"rect",x:68,y:38,width:1184,height:1280,fill:"frame",hole:{x:80,y:50,width:1160,height:1268}},{type:"polygon",points:[[0,1178],[660,1318],[1320,1178],[1320,1558],[0,1558]],fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:160,y:1318,width:1e3,height:220}}]};var pn={kind:"qrdx.frame",version:1,artboard:{width:1230,height:1430},qr:{x:115,y:115,size:1e3,padding:70,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:0,y:0,width:1230,height:1430,fill:"background"},{type:"polygon",points:[[0,0],[200,0],[200,35],[35,35],[35,200],[0,200]],fill:"frame"},{type:"polygon",points:[[1230,0],[1030,0],[1030,35],[1195,35],[1195,200],[1230,200]],fill:"frame"},{type:"polygon",points:[[1230,1230],[1030,1230],[1030,1195],[1195,1195],[1195,1030],[1230,1030]],fill:"frame"},{type:"polygon",points:[[0,1230],[200,1230],[200,1195],[35,1195],[35,1030],[0,1030]],fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:80,y:1210,width:1070,height:200},collapse:{y:1230,height:200}}]};var Kt={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1360},qr:{x:130,y:130,size:1e3,padding:40,plate:"background"},colors:{frame:"#7c3aed",text:{mix:["frame","accent"],amount:.5},accent:"#db2777"},shapes:[{type:"rect",x:50,y:50,width:1160,height:1260,radius:50,fill:"background"},{type:"rect",x:0,y:0,width:1260,height:1360,radius:100,fill:{gradient:{from:"frame",to:"accent",direction:"horizontal",steps:48}},hole:{x:50,y:50,width:1160,height:1260,radius:50}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:1130,width:1e3,height:180},collapse:{y:1210,height:100}}]};var dn={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1460},qr:{x:130,y:260,size:1e3,padding:46,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:0,y:0,width:1260,height:1460,radius:30,fill:"background"},{type:"rect",x:0,y:0,width:1260,height:1460,radius:30,fill:"frame",hole:{x:22,y:22,width:1216,height:1416,radius:8}},{type:"rect",x:45,y:45,width:1170,height:1370,fill:"frame",hole:{x:53,y:53,width:1154,height:1354}},{type:"rect",x:378,y:181,width:504,height:8,fill:"frame"},{type:"polygon",points:[[630,163],[652,185],[630,207],[608,185]],fill:"frame"}],labels:[{type:"text",id:"title",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:30,width:1e3,height:170},collapse:{y:84,height:130}},{type:"text",id:"footer",slot:"secondary",text:"",color:"text",box:{x:130,y:1270,width:1e3,height:160},collapse:{y:1306,height:70}}]};var fn={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1610},qr:{x:130,y:250,size:1e3,padding:75,radius:55},colors:{frame:"#000000"},shapes:[{type:"rect",x:0,y:0,width:1260,height:1610,radius:170,fill:"frame"},{type:"rect",x:50,y:170,width:1160,height:1290,radius:60,fill:"background"},{type:"rect",x:520,y:67,width:220,height:36,radius:18,fill:"background"},{type:"rect",x:480,y:1520,width:300,height:30,radius:15,fill:"background"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:1290,width:1e3,height:170},collapse:{y:1330,height:130}}]};var hn={kind:"qrdx.frame",version:1,artboard:{width:1325,height:1555},qr:{x:150,y:150,size:1e3,padding:80},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:25,y:25,width:1300,height:1530,radius:15,fill:{mix:["frame","#FFFFFF"],amount:.72}},{type:"rect",x:0,y:0,width:1300,height:1530,radius:15,fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:150,y:1260,width:1e3,height:240}}]};var gn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1340},qr:{x:120,y:120,size:1e3,padding:40,plate:"background"},colors:{frame:"#000000"},shapes:[{type:"rect",x:40,y:40,width:1160,height:1260,radius:60,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1340,radius:100,fill:"frame",hole:{x:40,y:40,width:1160,height:1260,radius:60}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1120,width:1e3,height:180},collapse:{y:1200,height:100}}]};var yn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1565},qr:{x:120,y:120,size:1e3,padding:70,radius:20,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:40,y:40,width:1160,height:1160,radius:30,fill:"background"},{type:"rect",x:0,y:0,width:1240,height:1240,radius:70,fill:"frame",hole:{x:40,y:40,width:1160,height:1160,radius:30}},{type:"polygon",points:[[540,1385],[620,1265],[700,1385]],fill:"frame"},{type:"rect",x:0,y:1345,width:1240,height:220,radius:110,fill:"frame"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:1345,width:1e3,height:220}}]};var bn={kind:"qrdx.frame",version:1,artboard:{width:1240,height:1565},qr:{x:120,y:445,size:1e3,padding:70,radius:20,plate:"background"},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:0,y:0,width:1240,height:220,radius:110,fill:"frame"},{type:"polygon",points:[[540,180],[700,180],[620,300]],fill:"frame"},{type:"rect",x:40,y:365,width:1160,height:1160,radius:30,fill:"background"},{type:"rect",x:0,y:325,width:1240,height:1240,radius:70,fill:"frame",hole:{x:40,y:365,width:1160,height:1160,radius:30}}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:120,y:0,width:1e3,height:220}}]};var xn={kind:"qrdx.frame",version:1,artboard:{width:1420,height:1590},qr:{x:195,y:195,size:1e3,padding:80},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"rect",x:30,y:30,width:1390,height:1560,radius:155,fill:{mix:["frame","#FFFFFF"],amount:.7}},{type:"rect",x:0,y:0,width:1390,height:1560,radius:155,fill:"#FFFFFF"},{type:"rect",x:25,y:25,width:1340,height:1510,radius:130,fill:"frame"},{type:"rect",x:95,y:95,width:1200,height:1200,radius:40,fill:"background"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:175,y:1295,width:1040,height:240},collapse:{y:1365,height:170}}]};var Sn={kind:"qrdx.frame",version:1,artboard:{width:1280,height:1620},qr:{x:140,y:320,size:1e3,padding:80,radius:20},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"path",d:"M140 0H1140L1280 140V1580A40 40 0 0 1 1240 1620H40A40 40 0 0 1 0 1580V140ZM600 115.2A40 40 0 1 1 680 115.2A40 40 0 1 1 600 115.2Z",fill:"frame",fillRule:"evenodd"},{type:"path",d:"M572 115.2A68 68 0 1 1 708 115.2A68 68 0 1 1 572 115.2ZM600 115.2A40 40 0 1 1 680 115.2A40 40 0 1 1 600 115.2Z",fill:{mix:["frame","#FFFFFF"],amount:.35},fillRule:"evenodd"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:140,y:1400,width:1e3,height:220},collapse:{y:1420,height:160}}]};var Mn={kind:"qrdx.frame",version:1,artboard:{width:1260,height:1490},qr:{x:130,y:130,size:1e3,padding:80,radius:20},colors:{frame:"#000000",text:"#FFFFFF"},shapes:[{type:"path",d:"M40 0H1220A40 40 0 0 1 1260 40V1215A55 55 0 0 0 1260 1325V1450A40 40 0 0 1 1220 1490H40A40 40 0 0 1 0 1450V1325A55 55 0 0 0 0 1215V40A40 40 0 0 1 40 0Z",fill:"frame"},{type:"line",x1:77,y1:1270,x2:1147,y2:1270,width:12,dash:[30,22],fill:"background"}],labels:[{type:"text",id:"cta",slot:"primary",text:"Scan me",color:"text",box:{x:130,y:1270,width:1e3,height:220}}]};var T=(t,e,n,r,i)=>({style:t,name:e,tags:i,labelOn:r,spec:n}),En=[T("banner-bottom","Banner",Fe,"frame",["bottom","band"]),T("banner-top","Top banner",an,"frame",["top","band"]),T("banner-top-bottom","Two banners",sn,"frame",["top","bottom","band"]),T("border","Border",ln,"background",["square","outline"]),T("rounded-border","Rounded",gn,"background",["border","outline"]),T("gradient-border","Gradient",Kt,"background",["border","colorful"]),T("focus","Focus",pn,"background",["corners","brackets"]),T("speech-bubble","Bubble",yn,"frame",["speech"]),T("speech-bubble-top","Bubble top",bn,"frame",["speech"]),T("chat-bubble","Chat",cn,"frame",["message","bubble"]),T("circle","Circle",un,"frame",["round","ring","curved"]),T("badge","Ribbon",on,"frame",["badge","banner"]),T("sticker","Sticker",xn,"frame",["label"]),T("polaroid","Polaroid",hn,"frame",["photo","picture"]),T("phone","Phone",fn,"background",["mobile","screen"]),T("ticket","Ticket",Mn,"frame",["event","pass"]),T("tag","Tag",Sn,"frame",["price","label"]),T("envelope","Envelope",mn,"frame",["mail","letter"]),T("menu-card","Menu card",dn,"background",["menu","restaurant"])],Io=new Map(En.map(t=>[t.style,t]));function vo(t){return Io.get(t)}var ms=Object.fromEntries(En.map(t=>[t.style,t.spec])),ps={from:Kt.colors.frame,to:Kt.colors.accent};var _o={primary:"text",secondary:"secondaryText"};function Fn(t,e,n){let r=vo(e.style)?.spec??Fe;return Ee(t,Me(r),e,n,_o)}var $o="system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif";function Rn(t){return!!(t?.style&&t.style!=="none")}function An(t,e,n){return e.style===me?rn(t,e,n):Fn(t,e,n)}function To(t){return[...t.label?[t.label]:[],...t.extraLabels??[]]}function wn(t,e){let n=({x:r,y:i,width:c,height:s,radius:o})=>{let a=Math.min(o,c/2,s/2);t.moveTo(r+a,i),t.arcTo(r+c,i,r+c,i+s,a),t.arcTo(r+c,i+s,r,i+s,a),t.arcTo(r,i+s,r,i,a),t.arcTo(r,i,r+c,i,a),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(([i,c],s)=>{s===0?t.moveTo(i,c):t.lineTo(i,c)}),t.closePath(),t.fill()):(n(r),r.hole&&n(r.hole),t.fill("evenodd"))}for(let r of To(e))t.fillStyle=r.color,t.font=`${r.fontWeight??700} ${r.fontSize}px ${$o}`,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 No=.22,Oo=.14;function ko(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 Ce(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)*No: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 Ln(t,e){return e?ko(t,Oo):t}var{QrCode:Pe}=Q,zo={"1L":3,"1M":2,"1Q":1,"1H":1,"2L":2,"3L":1};function Bo(t){let e=t*4+17,n=new Uint8Array(e*e),r=(s,o)=>{s>=0&&o>=0&&s<e&&o<e&&(n[o*e+s]=1)};for(let s=0;s<e;s++)r(6,s),r(s,6);for(let[s,o]of[[3,3],[e-4,3],[3,e-4]])for(let a=-4;a<=4;a++)for(let l=-4;l<=4;l++)r(s+l,o+a);let i=[];if(t>1){let s=Math.floor(t/7)+2,o=t===32?26:Math.ceil((t*4+4)/(s*2-2))*2;i.push(6);for(let a=e-7;i.length<s;a-=o)i.splice(1,0,a)}let c=i.length-1;for(let[s,o]of i.entries())for(let[a,l]of i.entries())if(!(s===0&&a===0||s===0&&a===c||s===c&&a===0))for(let u=-2;u<=2;u++)for(let m=-2;m<=2;m++)r(o+m,l+u);for(let s=0;s<=8;s++)r(8,s),r(s,8);for(let s=0;s<8;s++)r(e-1-s,8),r(8,e-1-s);if(t>=7)for(let s=0;s<18;s++){let o=e-11+s%3,a=Math.floor(s/3);r(o,a),r(a,o)}return n}function qo(t,e){let n=t*4+17,r=tt[e].ordinal,i=Pe.NUM_ERROR_CORRECTION_BLOCKS[r]?.[t]??0,c=Pe.ECC_CODEWORDS_PER_BLOCK[r]?.[t]??0,s=Math.floor(Pe.getNumRawDataModules(t)/8),o=i-s%i,a=Math.floor(s/i),l=Array.from({length:i},(M,F)=>a+(F<o?0:1)),u=[],m=[],p=a-c;for(let M=0;M<=a;M++)for(let F=0;F<i;F++)if(F<o){if(M===p)continue;u.push(F),m.push(M<p?M:M-1)}else u.push(F),m.push(M);if(u.length!==s)throw new Error(`Codeword map: interleave mismatch at version ${t}`);let f=Bo(t),y=new Int16Array(n*n).fill(-1),h=new Int16Array(n*n).fill(-1),g=new Int8Array(n*n).fill(-1),x=s*8,d=0;for(let M=n-1;M>=1;M-=2){M===6&&(M=5);let F=(M+1&2)===0;for(let P=0;P<n;P++)for(let E=0;E<2;E++){let I=M-E,N=(F?n-1-P:P)*n+I;if(!f[N]&&d<x){let B=d>>>3;y[N]=u[B],h[N]=m[B],g[N]=7-(d&7),d++}}}if(d!==x)throw new Error(`Codeword map: placement mismatch at version ${t}`);let C=zo[`${t}${e}`]??0;return{version:t,level:e,size:n,blocks:i,eccPerBlock:c,blockLengths:l,correctable:Math.floor((c-C)/2),block:y,codeword:h,bit:g}}var Do=8,ct=new Map;function In(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=ct.get(n);if(r)return ct.delete(n),ct.set(n,r),r;let i=qo(t,e);if(ct.size>=Do){let c=ct.keys().next().value;c!==void 0&&ct.delete(c)}return ct.set(n,i),i}function vn(t,e){let n=new Array(t.blocks).fill(0),r=new Set;for(let i of e){let c=t.block[i]??-1;if(c<0)continue;let s=c*4096+t.codeword[i];r.has(s)||(r.add(s),n[c]=n[c]+1)}return n}import{z as R}from"zod";import{z as X}from"zod";var Go=["logo","halftone"],Qo=X.enum(Go),_n={logo:["blend","badge"],halftone:["color","mono"]},Uo=X.enum([..._n.logo,..._n.halftone]),Jt=192,$n=t=>Math.ceil(t/3)*4,Ho=X.object({width:X.number().int().min(1).max(Jt),height:X.number().int().min(1).max(Jt),data:X.string().max($n(Jt*Jt*4))}).refine(t=>t.data.length===$n(t.width*t.height*4),{message:"Art image data does not match its width and height"}),Tn=X.object({mode:Qo,image:Ho,intensity:X.number().min(0).max(1).optional(),variant:Uo.optional(),matchEyes:X.boolean().optional()});import{z as L}from"zod";var Ls=L.enum(["solid","linear","radial","angular","image"]),Vo=L.object({type:L.literal("solid"),color:L.string()}),Re=L.object({color:L.string(),offset:L.number().min(0).max(100)}),Yo=L.object({type:L.literal("linear"),stops:L.array(Re).min(2),angle:L.number().optional().default(0)}),jo=L.object({type:L.literal("radial"),stops:L.array(Re).min(2)}),Zo=L.object({type:L.literal("angular"),stops:L.array(Re).min(2),angle:L.number().optional().default(0)}),Xo=L.enum(["cover","contain","tile"]),Wo=L.enum(["top-left","top","top-right","left","center","right","bottom-left","bottom","bottom-right"]),Ko=L.object({type:L.literal("image"),src:L.string().min(1),fit:Xo.optional().default("cover"),scale:L.number().min(.1).max(4).optional().default(1),position:Wo.optional().default("center"),opacity:L.number().min(0).max(1).optional().default(1),underlay:L.string().optional()}),ut=L.union([L.string(),Vo,Yo,jo,Zo,Ko]);import{z as Nn}from"zod";var On=["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"],Jo=["diamond","star","banner"],kn=Nn.enum([...On,...Jo]),_s=Nn.enum(On);import{z as zn}from"zod";var Bn=["square","rounded","gear","circle","diya","extra-rounded","message","pointy","leaf","drop","octagon","bevel","squircle","cushion","shield","petal","leaf-reverse"],ti=["curly"],qn=zn.enum([...Bn,...ti]),Ns=zn.enum(Bn);import{z as ei}from"zod";var ni=["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"],Dn=ei.enum(ni);var ri=["square","rounded","circle"],Gn=R.enum(ri),oi=R.object({src:R.string(),height:R.number(),width:R.number(),excavate:R.boolean(),x:R.number().optional(),y:R.number().optional(),padding:R.number().min(0).optional(),shape:Gn.optional(),plate:R.string().optional()}),ii=.1,ai=.3;var si=2,Vs=R.object({size:R.number().min(ii).max(ai).optional(),padding:R.number().min(0).max(si).optional(),x:R.number().min(0).max(1).optional(),y:R.number().min(0).max(1).optional(),shape:Gn.optional(),plate:R.string().optional()}),li=R.enum(["L","M","Q","H"]),ci=.5,ui=1,Qn=.07,mi=["square","circle","heart"],pi=R.enum(mi),Un=3,mt=64,It=8,Hn=.42,di=R.object({type:R.literal("silhouette"),width:R.number().int().min(It).max(mt),height:R.number().int().min(It).max(mt),cells:R.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"}),fi=R.union([pi,di]);var Ae=R.object({outer:ut.optional(),inner:ut.optional()}),hi=R.object({topLeft:Ae.optional(),topRight:Ae.optional(),bottomLeft:Ae.optional()}),Ys=R.object({value:R.string(),size:R.number().optional(),level:li.optional(),bgColor:ut.optional(),fgColor:ut.optional(),eyeColor:ut.optional(),dotColor:ut.optional(),bodyPattern:Dn.optional(),cornerEyePattern:qn.optional(),cornerEyeDotPattern:kn.optional(),margin:R.number().optional(),imageSettings:oi.optional(),isOGContext:R.boolean().optional(),templateId:R.string().optional(),customProps:R.record(R.string(),R.any()).optional(),frame:Ve.optional(),art:Tn.optional(),eyeColors:hi.optional(),moduleScale:R.number().min(ci).max(ui).optional(),autoLevel:R.boolean().optional(),shape:fi.optional()});var gi={2:6,3:12};function Vn(t){let e=[t.start],n=t.start;for(let r of t.segments){let i=r.at(-1);if(r.length===1)e.push(i);else{let c=gi[r.length];for(let s=1;s<=c;s++){let o=s/c,a=1-o;if(r.length===2){let[l]=r;e.push([a*a*n[0]+2*a*o*l[0]+o*o*i[0],a*a*n[1]+2*a*o*l[1]+o*o*i[1]])}else{let[l,u]=r;e.push([a*a*a*n[0]+3*a*a*o*l[0]+3*a*o*o*u[0]+o*o*o*i[0],a*a*a*n[1]+3*a*a*o*l[1]+3*a*o*o*u[1]+o*o*o*i[1]])}}}n=i}return e}function jn(t,e){let n=[];for(let r of t)for(let i=0;i<r.length;i++){let[c,s]=r[i],[o,a]=r[(i+1)%r.length];s<=e!=a<=e&&n.push(c+(e-s)/(a-s)*(o-c))}return n.sort((r,i)=>r-i)}function Zn(t,e){let n=0;for(let r of t)if(r<e)n++;else break;return n%2===1}function yi(t,e,n){return Zn(jn(t,n),e)}function Xn(t){let e=new Map;return(n,r)=>{let i=e.get(r);return i||(i=jn(t,r),e.set(r,i)),Zn(i,n)}}function bi(t,e,n,r){let i=n[0]-t,c=n[1]-e,s=r[0]-n[0],o=r[1]-n[1],a=u=>Math.max(Math.abs(i+u*s),Math.abs(c+u*o)),l=Math.min(a(0),a(1));for(let[u,m]of[[c-i,s-o],[-(i+c),s+o]])if(m!==0){let p=u/m;p>0&&p<1&&(l=Math.min(l,a(p)))}return l}function xi(t,e,n){if(!yi(t,e,n))return 0;let r=Number.POSITIVE_INFINITY;for(let i of t)for(let c=0;c<i.length;c++)r=Math.min(r,bi(e,n,i[c],i[(c+1)%i.length]));return Number.isFinite(r)?r:0}function Si(t){let e=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(let c of t)for(let[s,o]of c)e=Math.min(e,s),n=Math.min(n,o),r=Math.max(r,s),i=Math.max(i,o);return{x0:e,y0:n,x1:r,y1:i}}function Wn(t){let e=t.map(Vn),n=Si(e),r=n.x1-n.x0,i=n.y1-n.y0;if(!(r>0&&i>0))return null;let c=(y,h)=>{let g=Math.max(y-n.x0,n.x1-y,h-n.y0,n.y1-h);return g>0?xi(e,y,h)/(2*g):0},s={cx:n.x0+r/2,cy:n.y0+i/2,value:0};s.value=c(s.cx,s.cy);let o=32;for(let y=1;y<o;y++)for(let h=1;h<o;h++){let g=n.x0+r*h/o,x=n.y0+i*y/o,d=c(g,x);d>s.value&&(s={cx:g,cy:x,value:d})}let a=r/o,l=i/o;for(let y=0;y<6;y++){let h=s;for(let g=-2;g<=2;g++)for(let x=-2;x<=2;x++){let d=h.cx+a*x/2,C=h.cy+l*g/2,M=c(d,C);M>s.value&&(s={cx:d,cy:C,value:M})}a/=2,l/=2}if(s.value<=0)return null;let m=.5/Math.max(s.cx-n.x0,n.x1-s.cx,s.cy-n.y0,n.y1-s.cy),p=([y,h])=>[.5+(y-s.cx)*m,.5+(h-s.cy)*m],f=t.map(y=>({start:p(y.start),segments:y.segments.map(h=>h.map(p))}));return{rings:f,polygons:f.map(Vn),half:s.value}}function Kn(t,e){let n=([i,c])=>`${b(i*e)} ${b(c*e)}`,r="";for(let i of t.rings){r+=`M${n(i.start)}`;for(let c of i.segments){let s=c.length===1?"L":c.length===2?"Q":"C";r+=s+c.map(n).join(" ")}r+="Z"}return r}var Mi={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]]]},Yn;function Jn(){return Yn??=Wn([Mi]),Yn}function Ei(t){let{width:e,height:n,cells:r}=t;return Number.isInteger(e)&&Number.isInteger(n)&&e>=It&&n>=It&&e<=mt&&n<=mt&&typeof r=="string"&&r.length===e*n&&/^[01]*$/.test(r)?(i,c)=>i>=0&&c>=0&&i<e&&c<n&&r[c*e+i]==="1":null}var W=([t,e])=>`${t},${e}`;function Fi(t,e,n){let r=(a,l)=>t(a-1,l-1),i=new Map,c=(a,l)=>{for(let[u,m]of[[a,l],[l,a]]){let p=i.get(W(u))??[];p.push(m),i.set(W(u),p)}};for(let a=0;a<=n;a++)for(let l=0;l<=e;l++){let u=r(l,a),m=r(l+1,a),p=r(l+1,a+1),f=r(l,a+1),y=[l,a-.5],h=[l+.5,a],g=[l,a+.5],x=[l-.5,a];switch((u?8:0)+(m?4:0)+(p?2:0)+(f?1:0)){case 1:case 14:c(x,g);break;case 2:case 13:c(g,h);break;case 3:case 12:c(x,h);break;case 4:case 11:c(y,h);break;case 6:case 9:c(y,g);break;case 7:case 8:c(x,y);break;case 5:c(y,h),c(x,g);break;case 10:c(x,y),c(g,h);break;default:break}}let s=[],o=new Set;for(let[a,l]of i){if(o.has(a)||l.length===0)continue;let[u,m]=a.split(",").map(Number),p=[[u,m]];o.add(a);let f=[u,m],y=l[0];for(;!o.has(W(y));){o.add(W(y)),p.push(y);let h=Ci(i.get(W(y))??[],f,o);if(!h)break;f=y,y=h}p.length>=3&&s.push(Pi(p))}return s}function Ci(t,e,n){let r=W(e);return t.find(i=>W(i)!==r&&!n.has(W(i)))??t.find(i=>W(i)!==r)}function Pi(t){let e=[];for(let n=0;n<t.length;n++){let r=t[(n-1+t.length)%t.length],i=t[n],c=t[(n+1)%t.length],s=(i[0]-r[0])*(c[1]-i[1])-(i[1]-r[1])*(c[0]-i[0]);Math.abs(s)>1e-9&&e.push(i)}return e.length>=3?e:t}function Ri(t){let e=(c,s)=>[(c[0]+s[0])/2,(c[1]+s[1])/2],n=t.length,r=e(t[n-1],t[0]),i=t.map((c,s)=>[c,e(c,t[(s+1)%n])]);return{start:r,segments:i}}var vt=new Map;function tr(t){let e=`${t.width}x${t.height}:${t.cells}`,n=vt.get(e);if(n)return n;let r=Ei(t),i;if(!r)i={outline:null,problem:"invalid"};else if(t.cells.includes("1")){let c=Fi(r,t.width,t.height),s=c.length>0?Wn(c.map(Ri)):null;i=s&&2*s.half>=Hn?{outline:s,problem:null}:{outline:null,problem:s?"thin":"empty"}}else i={outline:null,problem:"empty"};return vt.size>16&&vt.delete(vt.keys().next().value),vt.set(e,i),i}var Ai=1,er=.5,nr=.5,wi=.5;function te(t){return Math.max(t,Un)}function we(t){return t==="heart"?Jn():typeof t=="object"&&t?.type==="silhouette"?tr(t).outline:null}function ot(t,e,n){if(n==="circle"){let s=te(e),o=(t/2+s)*Math.SQRT2+Ai;return Math.ceil(o-t/2)}let r=we(n);if(!r)return e;let i=te(e),c=(t+2*(i+wi))/(2*r.half);return Math.ceil((c-t)/2-1e-9)}function rr(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 Li(t,e,n){let r=ot(e,n,"circle"),i=te(n),c=e+2*r,s=c/2,o=s-er-.5,a=rr(Number.parseInt(be(t),36)||1),l=r-i,u=r+e+i;return Array.from({length:c},(m,p)=>Array.from({length:c},(f,y)=>{let h=a()<nr;return y>=l&&y<u&&p>=l&&p<u?!1:h&&Math.hypot(y+.5-s,p+.5-s)<=o}))}var Ii=Array.from({length:8},(t,e)=>{let n=e*Math.PI/4;return[Math.cos(n),Math.sin(n)]});function Le(t,e,n,r){if(r==="circle")return Li(t,e,n);let i=we(r);if(!i)return null;let c=ot(e,n,r),s=te(n),o=e+2*c,a=Xn(i.polygons),l=.5+er,u=(y,h)=>{let g=y+.5,x=h+.5;return a(g/o,x/o)?Ii.every(([d,C])=>a((g+d*l)/o,(x+C*l)/o)):!1},m=rr(Number.parseInt(be(t),36)||1),p=c-s,f=c+e+s;return Array.from({length:o},(y,h)=>Array.from({length:o},(g,x)=>{let d=m()<nr;return x>=p&&x<f&&h>=p&&h<f?!1:d&&u(x,h)}))}function Ie(t,e){if(t==="circle")return{circle:e/2};let n=we(t);return n?{path:Kn(n,e)}:null}function or(t,e){return t.slice().map((n,r)=>r<e.y||r>=e.y+e.h?n:n.map((i,c)=>c<e.x||c>=e.x+e.w?i:!1))}function ve(t,e=0){let n=[];return t.forEach((r,i)=>{let c=null;r.forEach((s,o)=>{if(!s&&c!==null){n.push(Dt`M${c+e} ${i+e}h${o-c}v1H${c+e}z`),c=null;return}if(o===r.length-1){if(!s)return;c===null?n.push(Dt`M${o+e},${i+e} h1v1H${o+e}z`):n.push(Dt`M${c+e},${i+e} h${o+1-c}v1H${c+e}z`);return}s&&c===null&&(c=o)})}),n.join("")}function _t(t,e,n,r){if(r==null)return null;let i=t.length,c=Math.floor(e*qt),s=(i+2*n)/e,o=(r.width||c)*s,a=(r.height||c)*s,l=r.x==null?i/2-o/2:r.x*s,u=r.y==null?i/2-a/2:r.y*s,m=null;if(r.excavate){let p=Math.max(0,r.padding??0)*s,f=Math.floor(l-p),y=Math.floor(u-p),h=Math.ceil(o+l+p-f),g=Math.ceil(a+u+p-y);m={x:f,y,w:h,h:g}}return{x:l,y:u,h:a,w:o,excavation:m}}function ee(t){let e=t.level??yt,{imageSettings:n}=t,r=t.isOGContext&&n?.excavate&&(e==="L"||e==="M")?"Q":e;if(t.autoLevel&&n&&r!=="H"){let i=Q.QrCode.encodeText(t.value,tt[r]).getModules(),c=_t(i,t.size??kt,ot(i.length,t.margin??Bt,t.shape),n);c&&(c.excavation?c.excavation.w*c.excavation.h:c.w*c.h)/(i.length*i.length)>Qn&&(r="H")}return r}var _e=(()=>{try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})();var vi=.6,_i=["L","M","Q","H"];function $i(t){let e=Q.QrCode.encodeText(t.value,tt[t.level]),n=_i[e.errorCorrectionLevel.ordinal]??t.level;return{code:t,cells:e.getModules(),layoutMargin:ot(e.size,t.margin,t.shape),map:In(e.version,n),level:n,version:e.version}}function Ti(t,e){let{cells:n,map:r}=t,i=n.length,c=_t(n,t.code.size,t.layoutMargin,e);if(!c)return null;let s=c.excavation??{x:Math.floor(c.x),y:Math.floor(c.y),w:Math.ceil(c.x+c.w)-Math.floor(c.x),h:Math.ceil(c.y+c.h)-Math.floor(c.y)},o=[];for(let l=Math.max(0,s.y);l<Math.min(i,s.y+s.h);l++)for(let u=Math.max(0,s.x);u<Math.min(i,s.x+s.w);u++)o.push(l*i+u);let a=vn(r,o);return{worst:Math.max(0,...a),correctable:r.correctable,budget:Math.floor(r.correctable*vi),level:t.level,version:t.version}}var Ni=t=>!t||t.worst<=t.budget;function Oi(t,e,n,r){let i=e.map(o=>$i({...t,level:o})),c=o=>{let a=r(o);return i.every(l=>Ni(Ti(l,a)))};if(c(n))return n;let s=t.size*.005;for(let o=n-s;o>0;o-=s)if(c(o))return o;return 0}function ir(t,e){if(!e)return;let n=Math.floor(t.size*qt),r=e.width||n,i=e.height||n,c=p=>{if(p===r)return e;let f=i*p/r;return{...e,width:p,height:f,...e.x!=null&&{x:e.x+(r-p)/2},...e.y!=null&&{y:e.y+(i-f)/2}}},s=t.level??yt,o={value:t.value,size:t.size,margin:t.margin,shape:t.shape},a=p=>ee({...t,level:s,imageSettings:p}),l=p=>{let f=Oi(o,[p],r,c);return f>0?c(f):void 0},u=a(e);if(u===s)return l(s);let m=l(u);return m&&a(m)===u?m:l(s)}import{Fragment as Bi,jsx as sr,jsxs as qi}from"react/jsx-runtime";function Rl(t){let{value:e,size:n=kt,level:r=yt,bgColor:i=et,fgColor:c=zt,margin:s=Bt,style:o,imageSettings:a,eyeColor:l,dotColor:u,bodyPattern:m,cornerEyePattern:p,cornerEyeDotPattern:f,isOGContext:y,templateId:h,customTemplate:g,customProps:x,frame:d,art:C,eyeColors:M,moduleScale:F,frameLabelMarkers:P,partMarkers:E,autoLevel:I,shape:w,...N}=t,B=ir({value:e,size:n,margin:s,level:r,shape:w,autoLevel:I},a),H=ee({value:e,size:n,level:r,margin:s,imageSettings:B,autoLevel:I,shape:w}),Y=B?.src,D=Rn(d)?An(n,d,i):null,K=D?.width??n,it=D?.height??n,pt=ar(null),G=ar(null),[U,V]=zi(!1);ki(()=>{if(pt.current!=null){let Mt=pt.current,v=Mt.getContext("2d");if(!v)return;let j=Q.QrCode.encodeText(e,tt[H]).getModules(),J=ot(j.length,s,w),ne=Le(e,j.length,s,w),ft=j.length+J*2,at=_t(j,n,J,B),Tt=G.current,$e=at!=null&&Tt?.complete&&Tt.naturalHeight!==0&&Tt.naturalWidth!==0;$e&&at.excavation!=null&&(j=or(j,at.excavation));let Nt=window.devicePixelRatio||1;Mt.width=K*Nt,Mt.height=it*Nt,v.scale(Nt,Nt),D&&(wn(v,D),v.translate(D.qrX,D.qrY));let Te=n/ft;v.scale(Te,Te),v.fillStyle=Lt(i,et);let Et=Ie(w,ft);if(Et&&"circle"in Et?(v.beginPath(),v.arc(ft/2,ft/2,Et.circle,0,2*Math.PI),v.fill()):Et&&_e?v.fill(new Path2D(Et.path),"evenodd"):v.fillRect(0,0,ft,ft),v.fillStyle=Lt(c,zt),_e)v.fill(new Path2D(ve(j,J))),ne&&v.fill(new Path2D(ve(ne,0)));else for(let[Ot,ht]of[[j,J],[ne??[],0]])Ot.forEach((Ft,st)=>{Ft.forEach((lr,cr)=>{lr&&v.fillRect(cr+ht,st+ht,1,1)})});if($e){let Ot={x:at.x+J,y:at.y+J,w:at.w,h:at.h},ht=B?.shape??"square",Ft=B?.plate,st=Ln(Ot,Ft);v.save(),Ft&&(Ce(v,ht,Ot),v.fillStyle=Ft,v.fill()),ht!=="square"&&(Ce(v,ht,st),v.clip()),v.drawImage(Tt,st.x,st.y,st.w,st.h),v.restore()}}});let dt={height:it,width:K,...o},$t=null;return Y!=null&&($t=sr("img",{alt:"QR code",onLoad:()=>{V(!0)},ref:G,src:Y,style:{display:"none"}},Y)),qi(Bi,{children:[sr("canvas",{height:it,ref:pt,style:dt,width:K,...N}),$t]})}export{Rl as QRCodeCanvas};
|
|
2
2
|
/**
|
|
3
3
|
* @license QR Code generator library (TypeScript)
|
|
4
4
|
* Copyright (c) Project Nayuki.
|